component
Divider
A thin line between things.
import { Divider } from 'rost/components/divider/Divider'
<Divider />src/components/divider/Divider.tsx
import type { HTMLAttributes } from 'react'
import './divider.css'
/**
* A 1px line, as wide as its container. Built from
* contracts/divider.contract.yaml.
*/
export function Divider({ className, ...rest }: HTMLAttributes<HTMLHRElement>) {
return <hr className={['rost-divider', className].filter(Boolean).join(' ')} {...rest} />
}When to use
- Between groups in a list or a menu, when space alone doesn't separate them.
When not to use
- Between every item. Space does that better.
- Holding up a layout. If the line goes, the layout should still read.
Behaviour
One 1px line in non-interactive/foreground/quinary, as wide as its container. Figma only has the horizontal one.
Accessibility
- Element: an
<hr>, so screen readers hear a break. Passaria-hidden="true"when it's only decoration.
Content
None. It's a line.
Where it's used
- runceanu.com
src/rost/divider/Divider.tsx.rost-divider - akount.ing
src/rost/divider/Divider.tsx.rost-divider
Values
Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.
Never changes
| Part | Property | Value | Token |
|---|---|---|---|
| root | display | block | layout |
| root | position | relative | layout |
| root | border | none | Figma frame size |
| root | height | 1px | spacing/outline/small |
| root | background | #282828 | non-interactive/foreground/quinary |
| root | width | 104px | Figma frame size |