# 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.

**Example: Station summary** (`examples/separator/sections.tsx`)

```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>
  )
}
```

## 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.

**Example: Item tools** (`examples/separator/item-toolbar.tsx`)

```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>
  )
}
```

## 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**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `"horizontal" \| "vertical"` | `'horizontal'` | The orientation of the separator. |
| `render` | `ReactElement<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](https://design-system.blocks-ui.com/components/box.md#escape-hatches) and [a ref](https://design-system.blocks-ui.com/components/box.md#refs), 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.
