Spacing is the foundation of visual rhythm and component encapsulation. VDS uses a base 4px grid with a systematic progression of spacing tokens to maintain visual consistency and predictable layouts.
When creating a new component, it is vital to ensure the styles and spacing rules are consistent with the brand foundations. Use the same 4px rhythm across padding, gaps, and layout spacing instead of introducing new ad hoc values.
We use Tailwind CSS for most layout and spacing utilities, so refer to the Tailwind spacing documentation and use classes like p, px, py, gap, space-x, and space-y where appropriate to keep consistency.
About margins
Avoid using margin — it leaks space outside of components and reduces reusability. Instead:
- Use container padding to control internal spacing
- Use flex/grid
gapto space content within layouts - Use parent padding to control spacing around child components
This ensures spacing is contained and predictable across different contexts.