fix(ui): support unset button size (#2207)

This commit is contained in:
zhifu gao
2026-08-04 15:38:23 +08:00
committed by GitHub
parent e502efa301
commit 5729350b6c
3 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -114,11 +114,15 @@ surface, border, shape, or color styling.
| `label` | `string?` | — | Button text |
| `disabled` | `boolean?` | `false` | Disabled state |
| `loading` | `boolean?` | `false` | Loading state |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size |
| `size` | `'sm' \| 'md' \| 'lg' \| 'unset'` | `'md'` | Preset size; `unset` leaves sizing to the caller |
| `block` | `boolean?` | `false` | Full width |
**Slots**: `default` (fallback when no `label`)
`size="unset"` omits the preset padding and text-size classes in `BasicButton`,
`Button`, and `GhostButton`. Callers must supply any required sizing, including
fixed dimensions for circular buttons.
### Button
Solid general-purpose action. It has no border and shows offset outlines on
@@ -24,6 +24,7 @@ const circleSizeClasses: Record<ButtonSize, string> = {
sm: 'h-8 w-8',
md: 'h-10 w-10',
lg: 'h-12 w-12',
unset: '',
}
const colorClasses: Record<ButtonColor, Record<ButtonVariant, string[]>> = {
@@ -19,6 +19,7 @@ const sizeClasses: Record<ButtonSize, string> = {
sm: 'min-h-7 px-2! py-1! text-xs',
md: 'min-h-8 px-3! py-1.5! text-sm',
lg: 'min-h-10 px-4! py-2! text-base',
unset: '',
}
const basicProps = computed(() => ({