Plain Divider
A single line between blocks of content. The spacing above and below scales through size modifiers so the separator breathes with the content around it.
Content above the divider.
Content below the divider.
<p>Content above the divider.</p>
<div class="nds-divider"></div>
<p>Content below the divider.</p>
Inside a Dropmenu
A common case for <hr class="nds-divider"> is separating groups of actions inside a menu (for example, routine actions from destructive ones).
<div class="nds-dropmenu">
<button class="nds-btn nds-secondary-outline nds-dropmenu-trigger">
<i class="nds-icon nds-hgi-menu-01" aria-hidden="true"></i>
<span class="nds-label">Actions</span>
</button>
<div class="nds-dropmenu-menu" hidden>
<div class="nds-dropmenu-scroll">
<button class="nds-btn nds-subtle nds-dropmenu-item">
<i class="hgi hgi-stroke hgi-edit-02"></i>
<span class="nds-label">Edit</span>
</button>
<button class="nds-btn nds-subtle nds-dropmenu-item">
<i class="nds-icon nds-hgi-copy-01"></i>
<span class="nds-label">Duplicate</span>
</button>
<button class="nds-btn nds-subtle nds-dropmenu-item">
<i class="nds-icon nds-hgi-share-01" aria-hidden="true"></i>
<span class="nds-label">Share</span>
</button>
<hr class="nds-divider">
<button class="nds-btn nds-subtle nds-dropmenu-item nds-destructive">
<i class="hgi hgi-stroke hgi-delete-02"></i>
<span class="nds-label">Delete</span>
</button>
</div>
</div>
</div>
Vertical Divider
Add nds-vertical and the same class renders as a vertical rule stretched to the parent's cross axis. Useful between inline stats, meta groups, or button clusters.
<div class="nds-flex nds-row" style="--gap: var(--spacing-md); --justify: center;">
<div>
<strong>125K</strong>
<span>Services</span>
</div>
<div class="nds-divider nds-vertical" style="--divider-size: 3px;"></div>
<div>
<strong>4.8</strong>
<span>Rating</span>
</div>
<div class="nds-divider nds-vertical" style="--divider-size: 3px;"></div>
<div>
<strong>23K</strong>
<span>Reviews</span>
</div>
</div>
Divider with Text
Adding any child content flips the divider into a flex row with two flanking lines. Useful for labeling sections or introducing alternative paths like "or continue with".
Sign in with National Single Sign-On
Use the credentials from your Nafath account to access the services provided by the university.
<div class="nds-card nds-shadow nds-stroke" style="--card-width: 400px;">
<div class="nds-card-content">
<div class="nds-card-text nds-center">
<h3 class="nds-card-title">Sign in with National Single Sign-On</h3>
<p class="nds-card-description">Use the credentials from your Nafath account to access the services provided by the university.</p>
</div>
<div class="nds-card-actions nds-row">
<a href="#" class="nds-btn nds-primary nds-lg nds-full">
<span class="nds-label">Continue with Nafath</span>
</a>
</div>
<div class="nds-divider">or</div>
<div class="nds-card-actions nds-row">
<button type="button" class="nds-btn nds-secondary-outline nds-lg nds-full">
<span class="nds-label">Sign in with University ID</span>
</button>
</div>
</div>
</div>
Built-in Features
Any child content automatically turns the divider into a centered label flanked by two balanced lines, no extra markup needed.
Six spacing modifiers from nds-md through nds-4xl control the margin around the rule, and the --divider-size token controls line thickness.
Uses logical properties, so a parent in vertical writing-mode renders the divider as a vertical line without extra rules.
Apply to <div>, <span>, or <hr>. Browser defaults on <hr> are reset so the result is consistent.
Usage Guidelines
Best Practices
- Use a plain divider to break up a long section of content when white space alone is not enough to signal a transition
- Use a divider with text to introduce an alternative path (for example "or", "continue with", or section labels between form groups)
- Use
<hr class="nds-divider">when the separation marks a thematic break in the content, and<div class="nds-divider">when it is purely visual - Do not use a divider to separate items inside a list. Add
nds-dividedto the list itself so the rule aligns with each row - Do not use a divider between a card and its surrounding text. Cards already carry their own boundary and an extra rule adds visual noise
- Pick the smallest size that gives enough breathing room. Oversized variants (
nds-3xl,nds-4xl) are for major section breaks, not paragraphs - Keep text inside a divider short: a single word or short phrase reads cleanly, longer sentences compete with the rules themselves
- Override
--divider-colorlocally to match surrounding surfaces (dark panels, tinted cards) rather than changing the global token
Modifier Classes
| Class | Description |
|---|---|
nds-vertical | Flips the rule to a vertical line. Stretches to the flex parent's cross axis. Spacing modifiers apply inline instead of block |
nds-md | Medium spacing around the rule |
nds-lg | Large spacing around the rule |
nds-xl | Extra-large spacing around the rule |
nds-2xl | 2X-large spacing around the rule |
nds-3xl | 3X-large spacing around the rule |
nds-4xl | 4X-large spacing around the rule |
CSS Custom Properties
| Property | Default | Description |
|---|---|---|
--divider | --spacing-xs | Block margin applied above and below the divider. Size modifiers override this value |
--divider-size | 2px | Thickness of the rule. Applies to the element border and the pseudo-element lines in the text variant |
--divider-color | --alpha-black-10 | Color of the rule. Swaps automatically to --alpha-white-10 in dark mode. Override per-instance to match surrounding surfaces |