diff --git a/packages/design-system/src/components/N8nButton/Button.stories.ts b/packages/design-system/src/components/N8nButton/Button.stories.ts
index aec891007c..c56532d98a 100644
--- a/packages/design-system/src/components/N8nButton/Button.stories.ts
+++ b/packages/design-system/src/components/N8nButton/Button.stories.ts
@@ -165,3 +165,9 @@ WithIcon.args = {
icon: 'plus-circle',
};
+export const Square = AllColorsAndSizesTemplate.bind({});
+Square.args = {
+ label: '48',
+ square: true,
+};
+
diff --git a/packages/design-system/src/components/N8nButton/Button.vue b/packages/design-system/src/components/N8nButton/Button.vue
index 05033ba02a..593389d5f7 100644
--- a/packages/design-system/src/components/N8nButton/Button.vue
+++ b/packages/design-system/src/components/N8nButton/Button.vue
@@ -75,6 +75,10 @@ export default Vue.extend({
validator: (value: string): boolean =>
['left', 'right'].includes(value),
},
+ square: {
+ type: Boolean,
+ default: false,
+ },
},
components: {
N8nSpinner,
@@ -96,7 +100,8 @@ export default Vue.extend({
`${this.text ? ` ${this.$style['text']}` : ''}` +
`${this.disabled ? ` ${this.$style['disabled']}` : ''}` +
`${this.block ? ` ${this.$style['block']}` : ''}` +
- `${this.icon || this.loading ? ` ${this.$style['icon']}` : ''}`;
+ `${this.icon || this.loading ? ` ${this.$style['icon']}` : ''}` +
+ `${this.square ? ` ${this.$style['square']}` : ''}`;
},
},
});
@@ -258,7 +263,7 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
--button-padding-horizontal: var(--spacing-2xs);
--button-font-size: var(--font-size-2xs);
- &.icon-button {
+ &.square {
height: 22px;
width: 22px;
}
@@ -269,7 +274,7 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
--button-padding-horizontal: var(--spacing-xs);
--button-font-size: var(--font-size-2xs);
- &.icon-button {
+ &.square {
height: 26px;
width: 26px;
}
@@ -280,14 +285,14 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
--button-padding-horizontal: var(--spacing-xs);
--button-font-size: var(--font-size-2xs);
- &.icon-button {
- height: 32px;
- width: 32px;
+ &.square {
+ height: 30px;
+ width: 30px;
}
}
.large {
- &.icon-button {
+ &.square {
height: 42px;
width: 42px;
}
@@ -298,7 +303,7 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
--button-padding-horizontal: var(--spacing-s);
--button-font-size: var(--font-size-m);
- &.icon-button {
+ &.square {
height: 46px;
width: 46px;
}
@@ -427,6 +432,7 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
.icon {
display: inline-flex;
+ justify-content: center;
svg {
display: block;
diff --git a/packages/design-system/src/components/N8nButton/__tests__/Button.spec.ts b/packages/design-system/src/components/N8nButton/__tests__/Button.spec.ts
index e86cc1f3ed..050609656e 100644
--- a/packages/design-system/src/components/N8nButton/__tests__/Button.spec.ts
+++ b/packages/design-system/src/components/N8nButton/__tests__/Button.spec.ts
@@ -43,6 +43,19 @@ describe('components', () => {
expect(wrapper.html()).toMatchSnapshot();
});
});
+
+ describe('square', () => {
+ it('should render square button', () => {
+ const wrapper = render(N8nButton, {
+ props: {
+ square: true,
+ label: '48',
+ },
+ stubs,
+ });
+ expect(wrapper.html()).toMatchSnapshot();
+ });
+ });
});
describe('overrides', () => {
diff --git a/packages/design-system/src/components/N8nButton/__tests__/__snapshots__/Button.spec.ts.snap b/packages/design-system/src/components/N8nButton/__tests__/__snapshots__/Button.spec.ts.snap
index 33ec8d07ad..a89fa3219a 100644
--- a/packages/design-system/src/components/N8nButton/__tests__/__snapshots__/Button.spec.ts.snap
+++ b/packages/design-system/src/components/N8nButton/__tests__/__snapshots__/Button.spec.ts.snap
@@ -1,12 +1,17 @@
// Vitest Snapshot v1
-exports[`components > N8nButton > overrides > should render correctly 1`] = `""`;
+exports[`components > N8nButton > overrides > should render correctly 1`] = `""`;
-exports[`components > N8nButton > props > icon > should render icon button 1`] = `""`;
+exports[`components > N8nButton > props > icon > should render icon button 1`] = `""`;
-exports[`components > N8nButton > props > loading > should render loading spinner 1`] = `""`;
+exports[`components > N8nButton > props > loading > should render loading spinner 1`] = `""`;
+
+exports[`components > N8nButton > props > square > should render square button 1`] = `
+""
+`;
exports[`components > N8nButton > should render correctly 1`] = `
-"