Gap
Vertical space measured in the system’s squares. A gap is an empty block as wide as its column, and its height is the only thing it has. One square by default, it stands between two things that need room and keeps that room on the grid.
Design examples
Section titled “Design examples”One square separates a title from its details; two squares mark the next section.
<section class="specimen">
<ds-row class="line" ><ds-text literal strong>Opening hours</ds-text></ds-row><ds-gap size="1"></ds-gap><ds-row class="line" ><ds-text literal >Tuesday to Sunday</ds-text></ds-row><ds-row class="line" ><ds-text literal class="mono">10:00–18:00</ds-text></ds-row><ds-gap size="2"></ds-gap><ds-row class="line" ><ds-text literal tone="muted">Last entry at 17:30</ds-text></ds-row>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style> Try it
Section titled “Try it”The gap separates two lines by one 20px square.
<div>First line</div>
<ds-gap unit></ds-gap>
<div>Second line</div> Choose a size
Section titled “Choose a size”Use unit for one square and double for two. The size attribute also selects a scale token, for example size="05" for half a square or size="2" for two squares.
A gap is empty space. It does not wrap content and is not a flexbox gap between children.
| Height | size | Attribute |
|---|---|---|
| A tenth of a square | 01 | tenth |
| A quarter of a square | 025 | quarter |
| Half a square | 05 | half |
| Four fifths of a square | 08 | eight-tenth |
| One square | 1 | unit |
| Two squares | 2 | double |
| Three squares | 3 | triple |
| Four squares | 4 | quad |
| Eight squares | 8 | oct |
| Twelve squares | 12 | dozen |
Behaviour
Section titled “Behaviour”A gap is a block that takes the column’s width, and it does not shrink in a flex column. Its height is multiplied by the surface scale, so it stays on the grid on phones. With no size it is one square. Add hidden to take it out.
Accessibility
Section titled “Accessibility”A gap has no role, no words and no focus, and assistive technology passes over it. Space says nothing to a screen reader, so let a heading or a list show that two things are separate.
size takes the values in the table, or use the attribute beside it. There are no slots or events.
| Token | What it does |
|---|---|
--ds-gap-row-space | Added once for each whole square of height, 0px by default. Sizes under one square add none. |
Copy gap through Sync 1. On Apple platforms it is DS1Gap.