Skip to content
Haze UI

Separator

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

pnpm dlx shadcn@latest add @haze/separator
Open preview in a new tab
Liveno JavaScript

When to use

  • 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

When not to use

  • Spacing alone already groups the content; extra lines add visual noise

Installation

Add the Haze registry to components.json once, then install Separator with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/separator
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Direction of the line; vertical stretches to the height of a flex parent.
decorativebooleantrueWhen 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.
labelstring–Short text centered on a horizontal line, drawn as an uppercase micro-label; ignored when vertical.
classstring–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.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • 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": "http://localhost:4329/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: http://localhost:4329/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.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog