Divider
A Divider is a visual element used to separate groups of content. It helps create structure, improve readability, and guide the user’s eye through sections of a layout.
Ready to use
A Divider is a simple visual element used to separate groups of content. It helps create structure, improve readability, and guide the user’s eye through sections of a layout. Dividers can be horizontal or vertical depending on the layout needs.
Anatomy
Section titled “Anatomy”- Line
When to use it
Section titled “When to use it”Use a Divider when:
- You need to separate sections of content within the same page or container.
- You want to create visual grouping inside cards, sidebars, lists, or forms.
- You need a subtle break between related UI elements without introducing heavy visual noise.
- You need to clarify hierarchy when headings or spacing alone are not enough.
Avoid a Divider when:
- Spacing alone is enough to create separation — generous padding or margins make the interface cleaner than adding a line.
- You want to show a change in context, navigation, or a major layout transition — use headers, subheaders, or layout components instead.
- You need to separate components with very strong contrast or visual weight — dividers may feel too subtle.
- You are trying to fix clutter — dividers shouldn’t compensate for an overcrowded layout.
Properties
Section titled “Properties”Line
The visual stroke itself. Adopts a muted, contrast, or accent fill from the surrounding scheme — never a custom colour.
Orientation
Horizontal by default (full width of its container). Switches to vertical inside toolbars, sidebars, and menus, where the line spans the container’s height instead.
Platform considerations
Section titled “Platform considerations”Desktop
Horizontal dividers stretch to the full content width. Vertical dividers fit the height of their containing row, with consistent inset spacing on each side.
Tablet
Same rules as desktop. Vertical dividers stay visible inside toolbars; in narrower content areas reach for spacing or a heading instead.
Mobile
Drop vertical dividers — horizontal ones span the full column width. Keep the visual weight light so the line doesn’t compete with stacked content.
Best practices
Section titled “Best practices”Use dividers sparingly. Structure should come from spacing and typography first; reach for a divider only when those aren’t enough.
Do
Align dividers to the surrounding grid, match the design-token weight to its scheme, and use semantic markup (<hr> for thematic breaks; role="separator" for purely visual ones).
Don't
Don’t mix multiple divider styles in the same view, don’t substitute dividers for headings, and don’t crowd them against adjacent content.
Content guidelines
Section titled “Content guidelines”Dividers are decorative — they carry no copy. If a separator needs a label, it’s a heading, not a divider. Keep dividers out of the tab order and don’t add text alternatives unless the divider communicates meaningful structure.
Styles
Section titled “Styles”A Divider is a visual element used to separate groups of content. It helps create structure, improve readability, and guide the user’s eye through sections of a layout.
<div class="tng-divider"></div>Variants
Section titled “Variants”The divider supports different fill colors: default (muted), primary (has a thicker stroke (2px)), and on-contrast. When no variant is set, the divider renders with the default muted color.
<div class="tng-divider"></div><div class="tng-divider is-primary"></div><div class="tng-divider on-contrast"></div>Container Pattern
Section titled “Container Pattern”Use .tng-has-dividers on a container to add border dividers between child elements.
<ul class="tng-has-dividers" role="list"> <li class="p-md">First item</li> <li class="p-md">Second item</li> <li class="p-md">Third item</li></ul>- First item
- Second item
- Third item
Add .has-edge to also draw dividers on the container’s leading and trailing edges.
<ol class="tng-has-dividers has-edge" role="list"> <li class="p-md">First item</li> <li class="p-md">Second item</li> <li class="p-md">Third item</li></ol>- First item
- Second item
- Third item
To draw only one edge, use .has-edge-start for the leading edge or .has-edge-end for the trailing edge. .has-edge is equivalent to applying both.
<ol class="tng-has-dividers has-edge-start" role="list"> <li class="p-md">First item</li> <li class="p-md">Second item</li> <li class="p-md">Third item</li></ol>- First item
- Second item
- Third item
<ol class="tng-has-dividers has-edge-end" role="list"> <li class="p-md">First item</li> <li class="p-md">Second item</li> <li class="p-md">Third item</li></ol>- First item
- Second item
- Third item
Orientation
Section titled “Orientation”Use .is-inline for vertical dividers. The divider will stretch to fill the available height.
<div class="tng-divider is-inline"></div><div class="tng-divider is-inline is-primary"></div>Modules
Section titled “Modules”Divider under heading
Section titled “Divider under heading”<header class="tng-stack"> <h2 class="mbe-4xl | tng-text-title is-5">Title Heading</h2> <div class="tng-divider is-primary" style="inline-size: 40px"></div></header>Title Heading
Vertical divider in nav menu
Section titled “Vertical divider in nav menu”<nav class="tng-group gap-2xl"> <a href="#" class="tng-link">Home</a> <a href="#" class="tng-link">Products</a> <div class="tng-divider is-inline" role="separator"></div> <a href="#" class="tng-link">Account</a> <a href="#" class="tng-link">Sign out</a></nav>Import the Divider component from @tmedxp/react-components.
Properties
Section titled “Properties”| Prop | Type | Description | Optional |
|---|---|---|---|
orientation |
Orientation |
Defines the divider orientation: 'horizontal' | 'vertical', 'horizontal' by default |
✅ |
variant |
Variant |
Defines the layout variant: 'is-primary' | 'on-contrast'. If not set, defaults to muted color. |
✅ |
testid |
string |
Defines the test id attribute value | ✅ |
as |
ValidHTMLTags |
Defines the html tag to use: 'hr' | 'div', 'div' by default |
✅ |
className |
ClassValue |
Custom class names applied to the divider element | ✅ |
Example
Section titled “Example”import { Divider } from '@tmedxp/react-components';
const DividerExample = () => { return ( <Divider orientation="vertical" variant="is-primary" className="custom-divider" /> );};
export { DividerExample };A divider separates groups of content with a line. It takes no keyboard focus and follows no APG interaction pattern, so an accessible divider is about meaning, not operation, and meets WCAG 2.1 AA. The one decision that matters is whether the line carries meaning: a divider that marks a genuine thematic break should expose that boundary to assistive technology as a separator (a native <hr>, or role="separator"), while a purely decorative divider — one whose separation is already implied by the surrounding structure or spacing — should stay a plain element with no role, so screen readers skip it instead of announcing an empty separator on every line.
For designers
Section titled “For designers”- When a divider marks a meaningful boundary, its line must reach a 3:1 contrast ratio against the surface it sits on, so the separation it conveys is actually perceivable. Source: WCAG 1.4.11 Non-text Contrast.
- A purely decorative divider is exempt from that minimum — but keep it perceivable enough to do its visual job; don’t lean on a hairline so faint it reads as a rendering artefact rather than a deliberate separation.
- Use the semantic divider fills (muted, primary, on-contrast) rather than fixed values, so the line adapts correctly across themes and surfaces.
For developers
Section titled “For developers”Render a divider decoratively by default: a bare <div class="tng-divider"> (or the CSS borders drawn by .tng-has-dividers between children) carries no role and stays out of the accessibility tree — which is correct when the separation only reinforces structure the markup already conveys, such as the boundaries between list items. Promote the divider to a real separator only when the line itself marks a boundary assistive technology would otherwise miss: render it as <hr> (the React component’s as="hr") or add role="separator", and screen readers announce it as a separator. Source: WCAG 1.3.1 Info and Relationships.
A separator is horizontal by default; for a vertical divider that separates groups — for example between navigation links — add aria-orientation="vertical" so its direction is exposed correctly. A divider never takes focus and needs no keyboard handling.