Skip to main content
Login

Sign in to access your account

Divider - National Design System

A line that separates content, horizontal or vertical, with an optional label between two lines

Overview

A divider is a line between two blocks of content. An empty divider draws one line. A divider with text draws the text between two lines, such as “or” between two sign-in options. nds-vertical turns it into a vertical line between items in a row.

Pick another component when:

Markup

Options
Structure
Spacing
Label position
Color
More
Preview

Your request was received on 12 March 2026.


The ministry replies by email within three working days.

<div> <p>Your request was received on 12 March 2026.</p> <hr class="nds-divider"> <p>The ministry replies by email within three working days.</p> </div>

Built-in Features

  • Text Annotation

    Any content inside the divider turns it into a label between two lines. No extra class is needed.

  • Works on Any Element

    The class works on <hr>, <div> and <span>. The browser's own <hr> look is reset. A plain <hr> with no class gets the divider look too, so CMS content matches.

  • Context Spacing

    Inside a dropmenu, the space around a divider matches the menu padding. Inside nds-prose, an <hr> gets 3XL space. A Spacing class still wins in both.

  • Writing-mode Aware

    Margins and lines use logical properties. In a parent with a vertical writing mode, the divider draws a vertical line with no extra class.

Best Practices

  • Use a divider when white space alone does not show where one part ends.
  • Do not put a divider between a card and the text around it. The card border already separates them.
  • Use a label divider for a second path (“or”, “continue with”) or to name a group of form fields.
  • Keep the label short. A long sentence competes with the lines.
  • To make the label flush with an edge, use nds-start or nds-end. A --divider-line-start of 0 still leaves a gap before the label.
  • Pick the smallest spacing that gives enough room. Keep nds-3xl and nds-4xl for major breaks.
  • Put a vertical divider only in a flex row. Outside one it has no height to stretch to.
  • Use the default color for most dividers. Use nds-primary only where the line is an accent.
  • On a deep primary surface, give the surface data-theme="dark oncolor primary": every divider inside takes the nds-oncolor look. See Color Areas. For one divider, add nds-oncolor. On a dark surface, add nds-oncolor, or give the surface data-theme="dark".
  • To change the line color on a tinted surface, set --divider-color on that surface, not on :root.

API

CSS Custom Properties

Set these on .nds-divider, or on a parent to change every divider inside it. A Spacing class sets --divider on the divider itself, so it wins over a parent value.

Property Default Controls
--divider var(--spacing-xs) Space above and below the line. On nds-vertical, the space before and after it
--divider-size 1px Line thickness, for the line and for both lines around a label
--divider-line-start none The longest the line before a label may be. Any length or percentage. The other line takes the rest of the width. It shrinks in a narrow container. Start follows the text direction: in Arabic it is the right-hand line
--divider-line-end none The same, for the line after a label
--divider-color var(--colors-alpha-black-10) Line color. A semantic token: dark mode sets it to var(--colors-alpha-white-10). nds-primary uses var(--border-primary) instead, and nds-oncolor uses var(--border-oncolor). With both, the line takes the label color
Last Modified Date: 20/11/2026 - 07:56 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks