Overview
The UISize system provides a unifiedxs | sm | md | lg | xl scale across all Kuzenbo components, ensuring consistent density and spacing throughout your application.
Installation
UISize Type
"md" as the default.
Size Constants
UI_SIZE_ORDER
The canonical ordering of size tokens.DEFAULT_UI_SIZE
The baseline size when no explicit size is provided.Size Resolution
resolveSize
Resolves the first non-null/undefined size from a list of candidates....candidates:(UISize | undefined | null)[]
UISize (never undefined)
Size Precedence
Components follow this resolution order:- Explicit child size - Direct prop on the component
- Container/context size - From parent wrapper or context
- Component default - Built-in component default
- Global provider size - From
KuzenboProvider.defaultSize - System default - Falls back to
"md"
Size Context
createSizeContext
Create a size context for container components that need to propagate size to descendants.defaultSize:UISize- Fallback when no size is provided (default:"md")
SizeContext: React Context for size propagationuseResolvedSize: Hook that resolves size using precedence chain
Metric Families
Kuzenbo provides shared sizing utilities for consistent density across component families.Field Height
For input-like controls and buttons.| Size | Class | Height |
|---|---|---|
| xs | h-6 | 1.5rem |
| sm | h-8 | 2rem |
| md | h-9 | 2.25rem |
| lg | h-10 | 2.5rem |
| xl | h-11 | 2.75rem |
Row Height
For tabs, toggles, menu items, and list rows.| Size | Class | Height |
|---|---|---|
| xs | h-6 | 1.5rem |
| sm | h-7 | 1.75rem |
| md | h-8 | 2rem |
| lg | h-9 | 2.25rem |
| xl | h-10 | 2.5rem |
Compact Visual
For checkbox, radio, and switch visual surfaces.| Size | Class | Size |
|---|---|---|
| xs | size-3 | 0.75rem |
| sm | size-3.5 | 0.875rem |
| md | size-4 | 1rem |
| lg | size-[18px] | 18px |
| xl | size-5 | 1.25rem |
Compact Target Size
Accessible tap/click target sizes for compact controls.| Size | Pixels |
|---|---|
| xs | 24 |
| sm | 28 |
| md | 32 |
| lg | 36 |
| xl | 40 |
Surface Spacing
For card, dialog, and container padding/gap.| Size | Class | Padding | Gap |
|---|---|---|---|
| xs | p-2 gap-1.5 | 0.5rem | 0.375rem |
| sm | p-3 gap-2 | 0.75rem | 0.5rem |
| md | p-4 gap-3 | 1rem | 0.75rem |
| lg | p-5 gap-3.5 | 1.25rem | 0.875rem |
| xl | p-6 gap-4 | 1.5rem | 1rem |
Field Text
Text sizing for input-like controls.| Size | Class | Size |
|---|---|---|
| xs | text-xs | 0.75rem |
| sm | text-sm | 0.875rem |
| md | text-sm | 0.875rem |
| lg | text-sm | 0.875rem |
| xl | text-base | 1rem |
Row Text
Text sizing for row/list/tab labels.| Size | Class | Size |
|---|---|---|
| xs | text-xs | 0.75rem |
| sm | text-xs | 0.75rem |
| md | text-sm | 0.875rem |
| lg | text-sm | 0.875rem |
| xl | text-base | 1rem |
Icon Sizing
Default icon size within controls.| Size | Class | Size |
|---|---|---|
| xs | size-3 | 0.75rem |
| sm | size-3.5 | 0.875rem |
| md | size-4 | 1rem |
| lg | size-4 | 1rem |
| xl | size-5 | 1.25rem |