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.

typescript

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.

props
required
ISizeProps
Component props extending ISizeProps. Reads the `size` value.
name
string
getCurrentInstanceName()
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

vue

Custom pixel size (Avatar)

vue