data-layout-density

Adjust spacing density for all children of a container. Controls gap sizes, line-height, and overall spacing.

Overview

Use data-layout-density on any container to adjust spacing for all children. The density cascades to all descendants, making it easy to switch between compact and spacious layouts.

Density Modes

Value Effect Use Case
compact~25% smaller spacing, tighter line-heightDashboards, data tables, admin UIs
(default)Standard spacingGeneral use
spacious~50% larger spacing, relaxed line-heightMarketing pages, landing pages

View the density demo →

Gap Modifier Reference

The data-layout-gap attribute controls spacing in all layout types.

Value Size Token Pixels
none00px
3xs--size-3xs2px
2xs--size-2xs4px
xs--size-xs8px
s--size-s12px
m--size-m16px
l--size-l24px
xl--size-xl32px
2xl--size-2xl48px
3xl--size-3xl64px