# Separator

> Hairline divider, horizontal or vertical, with an optional centered micro-label such as "or" between two sections.

- Kind: ui · Category: Layout and media · Interactivity: none
- Install: `npx shadcn@latest add @haze/separator`
- File: `src/components/haze/ui/separator.astro`
- npm dependencies: none
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/separator

## Use when
- Splitting a form into groups, for example social sign-in above an email form with an "or" label
- Dividing inline items in a toolbar or footer link row with a vertical rule
- Marking a thematic break between settings sections inside one card

## Avoid when
- Spacing alone already groups the content; extra lines add visual noise

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| orientation | `"horizontal" \| "vertical"` | "horizontal" | no | Direction of the line; vertical stretches to the height of a flex parent. |
| decorative | `boolean` | true | no | When true the line is hidden from assistive tech (role="none"). When false it is a real separator (role="separator", plus aria-orientation when vertical) and a label becomes its accessible name. |
| label | `string` |  | no | Short text centered on a horizontal line, drawn as an uppercase micro-label; ignored when vertical. |
| class | `string` |  | no | Extra classes, for example margins. |

## Accessibility
- Decorative by default (role="none"), so screen readers skip pure styling lines.
- With decorative set to false it exposes role="separator" and adds aria-orientation only for the vertical case.
- A real separator that has a label is named by it (aria-label) and the visible label text is hidden from the tree, so the text is read once as the name and not as loose content.
- A label on a decorative separator stays plain text in the reading order, so keep it short and meaningful, not a symbol.

## Agent prompts

### Install and use

Install the Haze UI component "Separator" with `npx shadcn@latest add @haze/separator`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Separator from "@/components/haze/ui/separator.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/separator.md

### Customize with real content

Adapt the Haze separator ui for our product. Replace the demo values of these props with our real content: orientation, decorative, label, class. Keep the layout, the heading level rules and these accessibility details: Decorative by default (role="none"), so screen readers skip pure styling lines. With decorative set to false it exposes role="separator" and adds aria-orientation only for the vertical case. A real separator that has a label is named by it (aria-label) and the visible label text is hidden from the tree, so the text is read once as the name and not as loose content. A label on a decorative separator stays plain text in the reading order, so keep it short and meaningful, not a symbol. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using separator, check it fits: use it when splitting a form into groups, for example social sign-in above an email form with an "or" label; dividing inline items in a toolbar or footer link row with a vertical rule; marking a thematic break between settings sections inside one card. Avoid it when spacing alone already groups the content; extra lines add visual noise.

## Example requests that should lead here
- Put an "or continue with" divider between the Google button and the email form
- Add a real separator labelled Danger zone above the delete account section

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

interface Props {
  orientation?: "horizontal" | "vertical";
  /** True hides the line from assistive tech. False exposes role="separator"; a label then becomes its accessible name. */
  decorative?: boolean;
  /** Short text centered on a horizontal line; ignored when vertical. */
  label?: string;
  class?: string;
}

const { orientation = "horizontal", decorative = true, label, class: className } = Astro.props;
const vertical = orientation === "vertical";
const role = decorative ? "none" : "separator";
const ariaOrientation = !decorative && vertical ? "vertical" : undefined;
const labelled = Boolean(label) && !vertical;
// A real separator has no readable children, so the label names it instead of being read as loose text.
const ariaLabel = !decorative && labelled ? label : undefined;
---

{
  labelled ? (
    <div role={role} aria-label={ariaLabel} class={cn("flex w-full items-center gap-3", className)}>
      <span class="h-px flex-1 bg-border" aria-hidden="true" />
      <span
        aria-hidden={decorative ? undefined : "true"}
        class="text-xs/4 font-medium text-muted-foreground"
      >{label}</span>
      <span class="h-px flex-1 bg-border" aria-hidden="true" />
    </div>
  ) : (
    <div
      role={role}
      aria-orientation={ariaOrientation}
      class={cn("shrink-0 bg-border", vertical ? "w-px self-stretch" : "h-px w-full", className)}
    />
  )
}
```
