How Grid Values Work
The grid system provides a consistent spacing scale across your application. Instead of using arbitrary pixel values, you use multipliers of your base grid unit:Default Grid Configuration
By default, Tokenami’s grid is set to0.25rem (typically 4px). This provides a fine-grained spacing scale that works well for most designs:
Custom Grid Configuration
You can customize the grid value to match your design system:Properties Using Grid Values
The grid system applies to spacing and positioning properties. Here are the properties that use grid values by default:Spacing Properties
paddingand all variants (padding-top,padding-inline, etc.)marginand all variants (margin-bottom,margin-block, etc.)gap,row-gap,column-gap
Positioning Properties
insetand all variants (inset-block,inset-inline, etc.)top,right,bottom,left
Sizing Properties
width,heightmin-width,min-heightmax-width,max-heightblock-size,inline-size- And their min/max variants
Other Properties
scroll-marginand variantsscroll-paddingand variantsflex-basiscolumn-widthbackground-positionand variants
Usage Examples
Basic Spacing
Layout Spacing
Responsive Spacing
Combine grid values with responsive breakpoints:Positioning
Using Specific Units
While grid values are recommended for consistency, you can still use specific CSS units when needed. See the Arbitrary Values guide for how to use custom values that don’t fit your grid system.Mixing Grid and Theme Values
Many properties accept both grid values (numbers) and theme tokens (CSS variables):Using grid values creates a consistent spacing system and makes it easier to maintain visual rhythm throughout your application. The grid system is particularly useful for spacing, while theme tokens are better for absolute sizes.