jbmui

Rule

  • UI

A labelled divider with ink or vermilion emphasis and two line weights.

Una idea a la vez
El siguiente capítulo

Install

npx shadcn@latest add @jbm/rule

Needs the @jbm entry in components.json; see Install once.

Also installs @jbm/tokens.

Usage

Labelled accent rule
import { Rule } from "@/jbm/ui/rule"<Rule label="Una idea a la vez" accent strong /><Rule /><Rule label="El siguiente capítulo" strong />

Props

Stage
fluid

Width is 100% of the container. Height is the line weight (1px, or 3px strong) without a label, or one line of 13px mono label text with a label; long labels wrap anywhere and add lines. The line keeps a 24px minimum width.

A full-width separator (role="separator") with an optional uppercase mono label before a flexible line. The line is 1px hairline by default or 3px when strong; its color is the line token, ink when strong, or vermilion when accent. Other div attributes pass through.

PropTypeDefaultDescription
labelstringnoneOptional editorial label (Geist Mono, 13px, uppercase) shown before the line; also becomes the separator's aria-label. Dim, or vermilion with accent.
strongbooleanfalseUses a 3px line instead of 1px, and ink instead of the hairline color when not accented.
accentbooleanfalseColors the line and label vermilion. Keep to one accent per composition.

Also accepts React.HTMLAttributes<HTMLDivElement>.

QA checks

  • Compare the four looks on cream: plain hairline, strong ink, labelled, and accent strong; the label sits on the line's vertical center with a 16px gap.
  • Check a long label on a narrow screen: it wraps and the line keeps at least 24px.
  • Confirm the separator is announced with its label as the accessible name, and without one when unlabelled.