useSize
Commons
stable
Resolves the `size` prop to component-local modifier classes and optional width/height inline styles. Named presets (x-small/small/default/large/x-large) emit BEM modifier classes; custom values emit pixel dimensions.
API
Signature
Signature TypeScript complète extraite du fichier du composable.
sizeClasses is most useful for typographic components (Btn, Chip) where the named size implies a font-size rung. For purely box-sized components (Avatar, Icon), use the numeric form and rely on sizeStyles.
Interfaces consommées
ISizeProps
API
Paramètres
Paramètres d'entrée acceptés par ce composable.
- propsrequisISizeProps
- Component props extending ISizeProps. Reads the `size` value.
- namestringgetCurrentInstanceName()
- Component name prefix for the `{name}--size-{value}` class.
API
Valeurs de retour
Propriétés et méthodes exposées par l'objet retourné par le composable.
- sizeClasses
- Component-local BEM modifier class (e.g. "origam-btn--size-small") plus the typographic utility class (e.g. "origam--text-sm") bridging the legacy to modern taxonomy.
- sizeStyles
- Inline width and height declarations for custom numeric or CSS-length sizes (when the value is not a named preset).
Usage
Exemples
Extraits de code prêts à coller.
Named size presets
Custom pixel size (Avatar)