Skip to the content

Kongens Nytorv

Metro M1, M2 and M3.

Line 5C to Husum TorvNext departure in 4 min

Props

NameTypeDefaultDescription
classNamestring—Joined after pn-Separator on the root
styleCSSProperties—Reaches the root
refRef<HTMLDivElement>—Reaches the root, the role="separator" element
classNamestring, default —
Joined after pn-Separator on the root
styleCSSProperties, default —
Reaches the root
refRef<HTMLDivElement>, default —
Reaches the root, the role="separator" element

Use it

import { Separator } from '@mylder/perron'

Ask your agent

get_reference({ library: "base-ui", component: "Separator" })

Keyboard and ARIA

From the Base UI reference for Separator and the installed Separator.js. "From" says who does it.

No keys: the separator is not focusable and does nothing (CR-6).

ElementRoleAccessible name fromStates announced
rootseparator, from Base UInone: a separator that is not focusable needs no namearia-orientation, from orientation, by Base UI

What axe won't catch, from the contract, each with how this component meets it:

  • Everything the eye is told, the ear is told, for every shape each prop accepts: the line the eye sees is the separator role the ear is told, in both orientations, with aria-orientation saying which.
  • Every landmark and named region has an accessible name: none here; a separator is neither.
  • Every default label can be overridden: none here; Separator owns no strings.
  • Every shape the type accepts renders, in every variant: both orientation values draw the line on their side; Separator takes no ReactNode prop.
  • A hidden copy kept for animation is aria-hidden, and a collapsed region is inert: none here; nothing animates or collapses.
  • Native semantics first: Base UI renders a <div> with the separator role, the role an <hr> gives natively, and render={<hr />} stays open to a caller who wants the native element, drawn the same (CR-3); no other ARIA.
  • Focus moves in reading order and returns on close: the separator is never a tab stop, so Tab passes from the content before it to the content after it.
  • Every target is at least size.target-min square: none here; the separator is not a target.
  • Loops stop when the system asks for less motion: none here; nothing moves.

Owned strings

No owned strings: the separator shows and announces no words, only its role.

Do and don't

For a caller using the component, with the reason. Each row is a rule: a must row's Don't is never right, a should row's needs a reason, and Checked by says what catches the Don't in a caller's code.

RuleLevelDoDon'tChecked by
DD-1shouldPut a Separator where two groups of content meet and the layout doesn't already set them apart, such as between a vehicle's facts and its actions in a panelPut one between every row of a list or after every paragraph: the interface around the map stays calm, and white space sets most things apart without a linereview
DD-2shouldSpace the line with its container's gap or padding, from the space.* scaleGive the separator a margin of its own: it adds to the container's gap, and two screens end up with two spacingsreview
DD-3mustPut a vertical Separator in a flex row, and a horizontal one in a block or a flex column, so the line runs the container's lengthPut a vertical one in block flow or a horizontal one in a flex row, where it has no length and draws nothingreview
DD-4mustUse ToolbarSeparator inside a Toolbar and MenuSeparator inside a Menu, and let Select draw its own between groupsPut a Separator in a toolbar, where it doesn't run across the bar, in a menu, where it isn't the menu's own part, or in a list, where a separator is not a listbox's child (CR-8)review
DD-5mustGive a break that needs words a headingPut text in the separator, or swap its role for none to hide it: a break the eye sees is one the ear is toldreview
DD-6mustDraw a panel's or card's edge with its own borderUse a Separator as an element's edge: it announces a break between two groups, which an edge is notreview