Dimension
Dimension tokens carry a number and a unit. They are the workhorse type: spacing, radii, sizes, border widths, and type metrics are all dimensions.
Value format
{ "$type": "dimension", "$value": { "value": 16, "unit": "px" } }| Field | Allowed |
|---|---|
value | Any finite number, including negative |
unit | "px" or "rem" — nothing else |
What you can type
| Input | Stored as |
|---|---|
16px | { value: 16, unit: "px" } |
1.5rem | { value: 1.5, unit: "rem" } |
16 | { value: 16, unit: "px" } — a bare number defaults to px |
-2px | { value: -2, unit: "px" } |
{global.space.md} | A reference |
em, %, vh, pt and every other CSS unit are rejected. This is strict
DTCG: the specification defines exactly two units so that a token is unambiguous
outside a CSS context.
Applying to Figma
Default target: Size (all).
| Group | Targets |
|---|---|
| Sizing | All, width, height, min width, max width, min height, max height |
| Border radius | All corners, top-left, top-right, bottom-right, bottom-left |
| Border width | All sides, top, right, bottom, left |
| Spacing | Padding (all + each side), gap, counter-axis gap |
| Typography | Font size, letter spacing, line height — text layers only |
| Effects | Shadow offset X, offset Y, blur radius, spread |
rem → px conversion
Figma has no notion of a root font size, so a rem value is multiplied by a
fixed base of 16 when applied. 1.5rem sets 24. The stored token keeps
rem, so export is unaffected.
This base is not configurable.
Silent no-ops
If the target property does not exist on the selected layer — a corner radius on a line, padding on a non-auto-layout frame — the apply is skipped without an error. Check the result before assuming it landed.
The effects targets are the exception: they modify the first drop or inner shadow and fail loudly with “add a drop or inner shadow first” if there is none.
Notes and limits
- Applying a dimension to letter spacing or line height forces the unit to pixels in Figma, even if the layer was using a percentage.
dimensioncannot be applied to opacity or rotation — use a number token for those.- When exported to a Figma Variable, only a
"16px"-style string is parsed; the DTCG object form is passed through unchanged. See Figma Variables.