Divider
A thin rule that separates content. It can carry a label to name the section it opens.
import { Divider } from 'neba';
<Divider />
<Divider>OR</Divider>
<Divider orientation="vertical" />;Props
| Prop | Type | Default | Description |
|---|---|---|---|
| orientationshared | 'horizontal' | 'vertical' | 'horizontal' | Which way the line runs. A vertical rule has no height of its own: it stretches to its flex parent |
| colorshared | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'primary' | Semantic colour role. The same hairline a Card scores its sections with |
| sizeshared | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Type scale of the label. The line itself has no size |
| length | number | string | — | How far the rule runs: the width of a horizontal divider, the height of a vertical one. A number is pixels, a string is any CSS length. Left out, a horizontal rule is the full width of its container and a vertical one stretches to its flex row |
| thickness | number | string | 1 | How thick the rule is. A number is pixels, a string is any CSS length |
| children | ReactNode | — | A label set into the line. A string is copied into aria-label as well |
| textAlign | 'start' | 'center' | 'end' | 'center' | Where the label sits. Off-centre leaves a short stub on the near side |
There is no variant and no elevation. The rule is drawn as a single border edge, so it takes no layout beyond its own thickness.
Examples
length and thickness
length is how far the rule runs (the width of a horizontal divider, the height of a vertical one), and thickness is how heavy it is. Both take a number of pixels or any CSS length. Left out, a horizontal rule fills its container and a vertical one stretches to the flex row it is in.
textAlign
A label in children splits the rule around it. center halves the line; start and end leave a short stub on the near side, so the label reads as set into the rule rather than floating above it.
orientation
vertical has no height of its own and stretches to its flex parent: the shape to use between control groups in a toolbar. A vertical label turns with the rule.
color
color applies to the rule only, and faintly.
Accessibility
- Renders with
role="separator". separatordoes not take its accessible name from content, so a string label is also passed through asaria-label. A node is left alone, since only the caller knows which part of it is the name: setaria-labelyourself if you need one.