Skip to content
Ndop UI

Separator

Visually or semantically separates content.

Ndop UI

Accessible Angular components you own.

Blog
Docs
Source
import { Component } from '@angular/core';
import { Separator } from '@/ui/separator/separator';

/** Horizontal and vertical separators between blocks of content. */
@Component({
  selector: 'example-separator-demo',
  imports: [Separator],
  template: `
    <div>
      <div class="space-y-1">
        <div class="text-sm leading-none font-medium">Ndop UI</div>
        <p class="text-muted-foreground text-sm">
          Accessible Angular components you own.
        </p>
      </div>
      <div ndSeparator class="my-4"></div>
      <div class="flex h-5 items-center space-x-4 text-sm">
        <div>Blog</div>
        <div ndSeparator orientation="vertical"></div>
        <div>Docs</div>
        <div ndSeparator orientation="vertical"></div>
        <div>Source</div>
      </div>
    </div>
  `,
})
export class SeparatorDemoExample {}

A separator divides content, horizontally or vertically. By default it is semantic, with role="separator" and aria-orientation, so assistive technology announces the division. Set decorative when the separation is only visual, for example between sections that headings already divide; it then gets role="none".

Installation

npx @ndop/cli add separator

Usage

import { Separator } from '@/ui/separator/separator';
<div>
  <div class="space-y-1">
    <div class="text-sm leading-none font-medium">Ndop UI</div>
    <p class="text-muted-foreground text-sm">
      Accessible Angular components you own.
    </p>
  </div>
  <div ndSeparator class="my-4"></div>
  <div class="flex h-5 items-center space-x-4 text-sm">
    <div>Blog</div>
    <div ndSeparator orientation="vertical"></div>
    <div>Docs</div>
    <div ndSeparator orientation="vertical"></div>
    <div>Source</div>
  </div>
</div>

Examples

Separator decorative

A decorative separator, hidden from assistive technology because the headings already divide the content.

Account

Name, email and password.

Notifications

Email and push preferences.

import { Component } from '@angular/core';
import { Separator } from '@/ui/separator/separator';

/**
 * A decorative separator, hidden from assistive technology because the
 * headings already divide the content.
 */
@Component({
  selector: 'example-separator-decorative',
  imports: [Separator],
  template: `
    <section class="max-w-sm text-sm">
      <h2 class="font-medium">Account</h2>
      <p class="text-muted-foreground">Name, email and password.</p>
      <div ndSeparator decorative class="my-4"></div>
      <h2 class="font-medium">Notifications</h2>
      <p class="text-muted-foreground">Email and push preferences.</p>
    </section>
  `,
})
export class SeparatorDecorativeExample {}

Accessibility

Implements the separator role pattern of the WAI-ARIA Authoring Practices.

Focus

  • The separator never receives focus and never changes focus.

Right-to-left

Nothing mirrors: orientation is the same in both directions.

API reference

Separator

[ndSeparator]role separator or none

Styled separator line, horizontal or vertical (@ndop/primitives/separator).

Manages aria-orientation.

Separator binding Type Default
[class]
Extra classes, merged last so they win.
string''
[orientation]
Layout direction of the separator.
'horizontal' | 'vertical''horizontal'
[decorative]
Whether the separator is purely visual. Decorative separators are hidden from assistive technology.
booleanfalse
Data attribute Values
data-slotseparator
data-orientation —

Agent notes

Do

  • Use orientation="vertical" between items in a row, inside a container with a height.
  • Set decorative when headings or landmarks already separate the content.

Don't

  • Don't use a separator to add spacing; use margin or gap.
  • Don't stack separators next to borders that already divide the same content.