Dividers
A line between things: between sections, between items in a group, or between controls in a row. Reach for proximity first, with gaps and margins; when a line is still needed, use this component.
The divider
The same divider works anywhere: in the main content, in a sidebar, in a card.
It is an <hr>, with the standard gap above and below it.
Standard gap
A section of content.
The next section.
And the one after it.
Relevant code
<p>A section of content.</p>
<hr>
<p>The next section.</p>
<hr>
<p>And the one after it.</p>
- <hr>
- The preferred form. Styled by the foundation with 32px above and
below (
--ds-space-8), no class needed, and it includesrole="separator"for free.
Modifiers
Tight gap
A smaller gap, for a line between items in a group.
An item in a group.
The next item in the same group.
And the one after it.
Relevant code
<p>An item in a group.</p>
<hr class="ds-divider ds-divider--tight">
<p>The next item in the same group.</p>
<hr class="ds-divider ds-divider--tight">
<p>And the one after it.</p>
- .ds-divider--tight
- Between items in a group rather than between sections:
16px above and below (
--ds-space-block). It works on an<hr>, which keeps the separator meaning. - .ds-divider--flush
- No margin at all; the caller owns the spacing.
Vertical dividers
For a row of controls, where an <hr> will not fit.
Search
Submit
Donate
Relevant code
<div class="ds-btn-group">
<span>Search</span>
<span class="ds-divider ds-divider--vertical" aria-hidden="true"></span>
<span>Submit</span>
<span class="ds-divider ds-divider--vertical" aria-hidden="true"></span>
<span>Donate</span>
</div>
- .ds-divider
- The class form, for where an
<hr>will not fit: inside a flex row, or on an element that is already there. It is decorative, so mark itaria-hidden— a real separator should be an<hr>. - .ds-divider--vertical
- For a row of controls. Height is in
em, so it follows the row's own text instead of needing a value per context.