Installation
pnpm dlx shadcn@latest add https://asciicn.dev/r/divider.jsonUsage
import { Divider } from "@/components/asciicn/divider";
export function Section() {
return <Divider label="Settings" align="start" />;
}The rule is a run of one glyph, clipped to the width of its container: ─ by default, ━ with variant="heavy", ═ for double, ┄ for dashed and - for plain ascii. The pattern variants repeat a short sequence: dots is ·, beads alternates ·• and diamonds spaces out ◆. Patterns start at the label and read outward on both sides, so the glyphs next to the label always match.
label sets text into the rule, ──── label ────. align="start" or "end" leaves a four-cell lead before it. Without a label, ornament sets a single glyph in the middle instead, such as ◆ or §.
Examples
Every variant
Each variant with its name as a start-aligned label, then a light rule with a ◆ ornament.
Labelled
A dashed rule with a centred label between two sign-in options.
Vertical
orientation="vertical" stacks the glyph down the height of a flex row, here between three stats.
Props
| Prop | Type | Default |
|---|---|---|
| variant The glyph or pattern the rule is drawn with. | Type: "light" | "heavy" | "double" | "dashed" | "ascii" | "dots" | "beads" | "diamonds" | Default "light" |
| orientation Across the container, or down the height of a flex row. | Type: "horizontal" | "vertical" | Default "horizontal" |
| label Text set into the rule. A string label is also the accessible name. | Type: ReactNode | Default – |
| align Where the label sits along the rule. | Type: "start" | "center" | "end" | Default "center" |
| ornament A glyph set into the middle when there is no label. | Type: string | Default – |
| color Glyph colour, a palette name or any CSS colour. | Type: AsciiColor | Default "grey" |
| cell Glyph cell height in CSS pixels. | Type: number | Default --ascii-cell |
Notes
- The root has
role="separator"andaria-orientation. The glyphs are hidden from screen readers; a stringlabelbecomes the separator'saria-label. - It is plain text with no measuring and no script, so it renders on the server, stays sharp at any zoom and never shifts the layout.
- A run is clipped where the container ends, so the last glyph of a pattern can be cut. Lines (
─━═┄-) hide the cut.