useMargin

Commons
stable

Resolves the `margin` shorthand prop into utility classes for spacing-scale steps (0–12) or inline margin declarations for custom values. Pass values as strings to opt into the scale ("4" → var(--origam-space---4)).

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

String "4" opts into the design-system scale (var(--origam-space---4) = 16 px). The numeric 4 is treated as raw pixels (legacy). Axis-specific utilities (mx, mt, …) are not yet in the Phase 1 manifest.

Interfaces consommées

IMarginProps

API

Paramètres

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

props
requis
IMarginProps
Component props extending IMarginProps. Reads the `margin` shorthand.
name
string
getCurrentInstanceName()
Component name prefix used for the `--marged` class. Defaults to the current Vue instance name.

API

Valeurs de retour

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

marginClasses
Utility class names (e.g. ["origam--m-4"]) for scale steps. Includes the `{name}--marged` class for boolean margin.
marginStyles
Inline CSS declarations for custom margin values not covered by the utility scale.

Usage

Exemples

Extraits de code prêts à coller.

Using the spacing scale

vue