Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
Spacing
Space scale
Spacing values are derived from a 9-step scale, which is used for props such as margin and padding. These props accept numeric strings from "1" to "9", which correspond to the steps in the scale below.
Space scale tokens
Space scale tokens can be also accessed using CSS variables. You can use these tokens to style your custom components, ensuring they are consistent with the rest of your theme.
Scaling
Values which affect layout (spacing, font size, line height) scale relatively to each other based on the scaling value defined in your Theme. This setting allows you to scale the UI density uniformly across your entire application.
Custom scaling values
Besides the five preset values, scaling accepts any positive, finite percentage such as "87.5%" or "115%". The factor is the percentage divided by 100. Unitless numbers, zero, negative and non-finite values throw an error that names the invalid input; values are not clamped.
Each nested Theme sets an absolute scaling, not a multiple of its parent. This sidebar renders at 90% and the content at 120%, whatever the outer value is:
Scaling changes only the tokens defined with --scaling, such as space, font sizes, line heights and radii. It is not equivalent to CSS zoom or a transform: images, borders and sizes you set yourself stay as they are. A style prop that sets --scaling on one theme root overrides it locally, but that value is not a theme setting and nested themes do not inherit it.
Scaling factor
The scaling factor token can be accessed using the --scaling CSS variable. If you need to use different scaling factors in your app, you can use this token in your custom styles, ensuring they are consistent with the rest of your theme.