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
Full TypeScript signature sourced from the composable file.
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.
Consumed interfaces
ISizeProps
API
Parameters
Input parameters accepted by this composable.
- propsrequiredISizeProps
- Component props extending ISizeProps. Reads the `size` value.
- namestringgetCurrentInstanceName()
- Component name prefix for the `{name}--size-{value}` class.
API
Return values
Properties and methods exposed by the composable return object.
- 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
Examples
Ready-to-paste usage snippets.
Named size presets
Custom pixel size (Avatar)