useDensity

Commons
stable

Emits the density modifier class (`compact`, `default`, `comfortable`) onto the root element. Component SCSS rules then pick up the matching density token to adjust spacing, padding and line-height without JS involvement.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useDensity only emits a class — there is no densityStyles. All spacing adjustments live in the component SCSS via the `{name}--density-*` selector tree.

Interfaces consommées

IDensityProps

API

Paramètres

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

props
requis
IDensityProps | Ref<number | string | undefined>
Component props extending IDensityProps, or a plain Ref. Reads the `density` value.
name
string
getCurrentInstanceName()
Component name prefix for the `{name}--density-{value}` class.

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

densityClasses
A single-element array containing the density modifier class (e.g. ["origam-btn--density-compact"]), or an empty array when density is null/undefined.

Usage

Exemples

Extraits de code prêts à coller.

Density variants

vue