Layout
Tessera UI uses a systematic spacing scale with a comfortable default density. This ensures visual rhythm, consistent alignment, and predictable component composition.
Spacing Scale
Section titled “Spacing Scale”All spacing uses tokens from this scale. Never use arbitrary pixel values.
The progression (6/10/16/20/24/32/40/48/64/80px) provides natural visual rhythm:
- 6px — minimum gap between closely related elements (label to field, icon to text)
- 10px — default inline gap, small button padding
- 16px — standard internal padding for components
- 20-24px — section gaps and medium component padding
- 32-40px — large container padding, section separation
- 48-80px — page-level layout spacing
Density Modes
Section titled “Density Modes”Density modes remap spacing tokens globally via the data-density attribute. Components automatically adjust without any code changes.
Density Token Remapping
Section titled “Density Token Remapping”| Token | Compact | Default | Spacious |
|---|---|---|---|
--ts-spacing-1 | 4px | 6px | 8px |
--ts-spacing-2 | 8px | 10px | 12px |
--ts-spacing-3 | 12px | 16px | 20px |
--ts-spacing-4 | 16px | 20px | 24px |
--ts-spacing-5 | 20px | 24px | 32px |
--ts-spacing-6 | 24px | 32px | 40px |
Apply density on any ancestor element:
<!-- Compact data table --><div data-density="compact"> <ts-table>...</ts-table></div>
<!-- Spacious marketing layout --><section data-density="spacious"> <ts-card>...</ts-card></section>Grid System
Section titled “Grid System”A 12-column grid provides the foundation for page layout.
Breakpoints
Section titled “Breakpoints”Breakpoints define responsive layout transitions. Stored as CSS custom properties for JS access (CSS media queries require static values).
/* Use in media queries with static values */@media (min-width: 640px) { /* sm */ }@media (min-width: 768px) { /* md */ }@media (min-width: 1024px) { /* lg */ }@media (min-width: 1280px) { /* xl */ }@media (min-width: 1536px) { /* 2xl */ }Spacing Rhythm in Practice
Section titled “Spacing Rhythm in Practice”Consistent spacing creates visual grouping. Related elements use smaller gaps; distinct sections use larger gaps.
The new dashboard components have been reviewed and are ready for integration testing.
10px gap between paragraphs / 20px block padding / 16px inline paddingTouch Targets
Section titled “Touch Targets”Minimum interactive area sizes ensure usability across input methods.
| Token | Value | Usage |
|---|---|---|
--ts-touch-target-min | 44px | Default minimum (WCAG compliant) |
--ts-touch-target-compact | 32px | Compact mode (data-dense UIs only) |