Today
4 in of new snow, light wind.
This week
Storm totals near 18 in.
A line between groups of content or actions, on Base UI. It renders role="separator" with aria-orientation, so screen readers perceive the division.
import { Separator } from '@blocks/design-system'Horizontal is the default: a full-width line between sections.
4 in of new snow, light wind.
Storm totals near 18 in.
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>
)
}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.
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>
)
}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.
| 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 and a ref, and the native attributes of the element it renders.