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.

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.

Interfaces consommées

ISizeProps

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

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

vue

Custom pixel size (Avatar)

vue