From 28eb3a4400149f2336b1cb0009708d541ffc5960 Mon Sep 17 00:00:00 2001 From: Barbapapazes Date: Thu, 2 Jul 2026 09:53:06 +0200 Subject: [PATCH] feat(button): add support for 2xs and 3xs to button --- docs/content.config.ts | 2 +- src/theme/button.ts | 30 +++++++++++++++---- .../__snapshots__/Button-vue.spec.ts.snap | 14 +++++++++ .../__snapshots__/Button.spec.ts.snap | 14 +++++++++ .../__snapshots__/FieldGroup-vue.spec.ts.snap | 24 +++++++++++++++ .../__snapshots__/FieldGroup.spec.ts.snap | 24 +++++++++++++++ 6 files changed, 102 insertions(+), 6 deletions(-) diff --git a/docs/content.config.ts b/docs/content.config.ts index 3977fb0d42..4a345db8a4 100644 --- a/docs/content.config.ts +++ b/docs/content.config.ts @@ -22,7 +22,7 @@ const Button = z.object({ to: z.string().optional(), target: z.enum(['_blank', '_self']).optional(), color: z.enum(['primary', 'neutral', 'success', 'warning', 'error', 'info']).optional(), - size: z.enum(['xs', 'sm', 'md', 'lg', 'xl']).optional(), + size: z.enum(['3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl']).optional(), variant: z.enum(['solid', 'outline', 'subtle', 'soft', 'ghost', 'link']).optional(), id: z.string().optional(), class: z.string().optional() diff --git a/src/theme/button.ts b/src/theme/button.ts index 1ae6ac6639..1d6d287e89 100644 --- a/src/theme/button.ts +++ b/src/theme/button.ts @@ -25,31 +25,43 @@ export default (options: Required) => ({ link: '' }, size: { - xs: { + '3xs': { + base: 'px-1 py-0.5 text-[8px]/3 gap-1 rounded-sm', + leadingIcon: 'size-3', + leadingAvatarSize: '3xs', + trailingIcon: 'size-3' + }, + '2xs': { + base: 'px-1.5 py-1 text-[10px]/3 gap-1 rounded-sm', + leadingIcon: 'size-3', + leadingAvatarSize: '3xs', + trailingIcon: 'size-3' + }, + 'xs': { base: 'px-2 py-1 text-xs gap-1', leadingIcon: 'size-4', leadingAvatarSize: '3xs', trailingIcon: 'size-4' }, - sm: { + 'sm': { base: 'px-2.5 py-1.5 text-xs gap-1.5', leadingIcon: 'size-4', leadingAvatarSize: '3xs', trailingIcon: 'size-4' }, - md: { + 'md': { base: 'px-2.5 py-1.5 text-sm gap-1.5', leadingIcon: 'size-5', leadingAvatarSize: '2xs', trailingIcon: 'size-5' }, - lg: { + 'lg': { base: 'px-3 py-2 text-sm gap-2', leadingIcon: 'size-5', leadingAvatarSize: '2xs', trailingIcon: 'size-5' }, - xl: { + 'xl': { base: 'px-3 py-2 text-base gap-2', leadingIcon: 'size-6', leadingAvatarSize: 'xs', @@ -131,6 +143,14 @@ export default (options: Required) => ({ color: 'neutral', variant: 'link', class: 'text-muted hover:text-default active:text-default disabled:text-muted aria-disabled:text-muted outline-inverted/25 focus-visible:outline-3' + }, { + size: '3xs', + square: true, + class: 'p-0.5' + }, { + size: '2xs', + square: true, + class: 'p-1' }, { size: 'xs', square: true, diff --git a/test/components/__snapshots__/Button-vue.spec.ts.snap b/test/components/__snapshots__/Button-vue.spec.ts.snap index b150b6d28b..4f455cf380 100644 --- a/test/components/__snapshots__/Button-vue.spec.ts.snap +++ b/test/components/__snapshots__/Button-vue.spec.ts.snap @@ -271,6 +271,20 @@ exports[`Button > renders with primary variant subtle correctly 1`] = ` " `; +exports[`Button > renders with size 2xs correctly 1`] = ` +"" +`; + +exports[`Button > renders with size 3xs correctly 1`] = ` +"" +`; + exports[`Button > renders with size lg correctly 1`] = ` "" `; +exports[`Button > renders with size 2xs correctly 1`] = ` +"" +`; + +exports[`Button > renders with size 3xs correctly 1`] = ` +"" +`; + exports[`Button > renders with size lg correctly 1`] = ` " +" +`; + +exports[`FieldGroup > renders with size 3xs correctly 1`] = ` +"
+
+ + +
+
" +`; + exports[`FieldGroup > renders with size lg correctly 1`] = ` "
diff --git a/test/components/__snapshots__/FieldGroup.spec.ts.snap b/test/components/__snapshots__/FieldGroup.spec.ts.snap index 9542fae864..cf13e2f9ca 100644 --- a/test/components/__snapshots__/FieldGroup.spec.ts.snap +++ b/test/components/__snapshots__/FieldGroup.spec.ts.snap @@ -28,6 +28,30 @@ exports[`FieldGroup > renders with default slot correctly 1`] = `
" `; +exports[`FieldGroup > renders with size 2xs correctly 1`] = ` +"
+
+ + +
+
" +`; + +exports[`FieldGroup > renders with size 3xs correctly 1`] = ` +"
+
+ + +
+
" +`; + exports[`FieldGroup > renders with size lg correctly 1`] = ` "