# Separator

A visual divider between content sections.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

<DocsBaseSwitcher base="web" component="separator" />

<ComponentPreview name="separator" title="separator.tsx">
<Component />
</ComponentPreview>

A div-based divider. Horizontal by default, vertical with `orientation="vertical"`. When `decorative` is true (the default) it renders with `role="none"`. Set `decorative={false}` when the divider carries structural meaning and should be announced to assistive tech.

## Installation [#installation]

<CodeTabs>
<TabsList>
<TabsTrigger value="cli">
Command
</TabsTrigger>

<TabsTrigger value="manual">
Manual
</TabsTrigger>
</TabsList>

<TabsContent value="cli">
```bash
npx frakment add separator
```
</TabsContent>

<TabsContent value="manual">
<Steps>
<Step>
Copy and paste the following code into your project.
</Step>

<ComponentSource name="separator" title="components/ui/separator.tsx" />

<Step>
Update the import paths to match your project setup.
</Step>
</Steps>
</TabsContent>
</CodeTabs>

## Usage [#usage]

```tsx title="separator.tsx"
import { Separator } from "@/components/ui/separator";
```

```tsx title="separator.tsx"
<Separator />;
```

## Vertical [#vertical]

<ComponentPreview name="separator-vertical" title="separator-vertical.tsx" src="examples/separator-vertical.tsx">
<a />
</ComponentPreview>

Pass `orientation="vertical"`. The divider fills its parent height and sets width to 1px. Use it inside a `flex` container with a fixed height.

```tsx
<div className="flex h-5 items-center gap-4 text-sm">
  <span>Docs</span>
  <Separator orientation="vertical" />
  <span>Source</span>
</div>
```

## Semantic [#semantic]

<ComponentPreview name="separator-decorative" title="separator-decorative.tsx" src="examples/separator-decorative.tsx">
<r />
</ComponentPreview>

`decorative={false}` renders `role="separator"` with `aria-orientation`. Use it when the divider communicates structure that a screen reader should announce. Default `true` hides the divider from the accessibility tree.

```tsx
<Separator decorative={false} />;
```

## API Reference [#api-reference]

### Separator [#separator]

<PropsTable rows={[{"name":"orientation","type":"horizontal | vertical","default":"horizontal","description":"Divider direction."},{"name":"decorative","type":"boolean","default":"true","description":"When true, renders role=none and hides from assistive tech. When false, role=separator with aria-orientation."},{"name":"className","type":"string","description":"Additional CSS classes merged with cn()."}]} />

## Accessibility [#accessibility]

- Default `decorative={true}` renders `role="none"`, so screen readers skip the divider.
- `decorative={false}` renders `role="separator"` and `aria-orientation` so the divider becomes part of the document structure.
- Do not attach `aria-label` to a decorative separator. It is invisible to assistive tech by design.

## Best Practices [#best-practices]

- **Use decorative by default.** Only opt into `decorative={false}` when the divider encodes structural meaning.
- **Prefer spacing over separators.** Gap or padding on the parent often reads better than a hard line.
- **Keep vertical separators short.** They work best inside inline rows (navigation, breadcrumbs, meta info).

## Related Components [#related-components]

- [Button Group](/docs/components/button-group): uses Separator between buttons
- [Item](/docs/components/item): list item layout with optional separator
- [Theming](/docs/guides/theming): customize the border token