Rule
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/ruleNeeds the @jbm entry in components.json; see Install once.
Also installs @jbm/tokens.
Usage
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
fluidWidth 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.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | none | Optional editorial label (Geist Mono, 13px, uppercase) shown before the line; also becomes the separator's aria-label. Dim, or vermilion with accent. |
strong | boolean | false | Uses a 3px line instead of 1px, and ink instead of the hairline color when not accented. |
accent | boolean | false | Colors 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.