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
Full TypeScript signature sourced from the composable file.
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.
Consumed interfaces
IMarginProps
API
Parameters
Input parameters accepted by this composable.
- propsrequiredIMarginProps
- Component props extending IMarginProps. Reads the `margin` shorthand.
- namestringgetCurrentInstanceName()
- Component name prefix used for the `--marged` class. Defaults to the current Vue instance name.
API
Return values
Properties and methods exposed by the composable return object.
- 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
Examples
Ready-to-paste usage snippets.
Using the spacing scale