Blocks Design System

Separator

A line between groups of content or actions, on Base UI. It renders role="separator" with aria-orientation, so screen readers perceive the division.

tsx
import { Separator } from '@blocks/design-system'

Between content

Horizontal is the default: a full-width line between sections.

Today

4 in of new snow, light wind.

This week

Storm totals near 18 in.

Source · separator/sections.tsx
separator/sections.tsx
import { Body, Heading, Separator, Stack } from '@blocks/design-system'

export default function Sections() {
  return (
    <Stack as="article" gap="md" aria-label="Station summary">
      <Stack gap="xs">
        <Heading as="h3" fontSize="md">
          Today
        </Heading>
        <Body margin="none">4 in of new snow, light wind.</Body>
      </Stack>
      <Separator />
      <Stack gap="xs">
        <Heading as="h3" fontSize="md">
          This week
        </Heading>
        <Body margin="none">Storm totals near 18 in.</Body>
      </Stack>
      {/* Purely visual: hidden from assistive technology. */}
      <Separator aria-hidden="true" dangerouslySetStyle={{ marginTop: 'var(--ds-space-md)' }} />
    </Stack>
  )
}
Station summary

Between action groups

Set orientation="vertical" in a row. The separator stretches to the row’s height. Label the groups on either side so the division means something when read aloud.

Source · separator/item-toolbar.tsx
separator/item-toolbar.tsx
import { Button, Separator, Stack } from '@blocks/design-system'

export default function ItemToolbar() {
  return (
    <Stack direction="row" gap="sm" align="center" role="toolbar" aria-label="Item tools" wrap="wrap">
      <Stack direction="row" gap="xs" role="group" aria-label="Edit">
        <Button type="button" size="sm">
          Rename
        </Button>
        <Button type="button" size="sm">
          Duplicate
        </Button>
      </Stack>
      <Separator orientation="vertical" />
      <Stack direction="row" gap="xs" role="group" aria-label="Status">
        <Button type="button" size="sm">
          Mark done
        </Button>
        <Button type="button" size="sm" variant="ghost">
          Archive
        </Button>
      </Stack>
    </Stack>
  )
}
Item tools

Decorative lines

When a line only decorates and divides nothing meaningful, hide it with aria-hidden="true", as the last line in the summary does. Separators are never focusable either way.

Props

Separator props
PropTypeDefaultDescription
orientation"horizontal" | "vertical"'horizontal'The orientation of the separator.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SeparatorState>—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.

Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.

Accessibility

  • Don’t use a separator to replace a heading; give each section one.
  • A vertical separator in a toolbar is read between the groups it divides.