Currently brewing — dede is in beta: a first set of components, with more to come. The API may still change.

Divider

A thin line between items.

import { Divider } from "@dede-style/ui/divider", then <Divider />. It renders an <hr>, so screen readers announce it as a separator.

WorkAbout

Contact

A 1px line that takes the length it is given. A horizontal divider fills the width of its container. A vertical one fills the height of the row it sits in.

Above, a vertical divider sits in a 40px square box between two links. With inset="text" it is exactly as tall as one line of the links’ text, and centred in the row.

It has no margin. Space it with the parent’s gap, like any other child.

Horizontal and vertical

orientation is horizontal, the default, or vertical.

ProfileSettings
Sign out
WorkAbout
Contact

A vertical divider takes its height from its row, so it needs a parent that is a flex or grid row. In plain block flow it has no height to take, and it does not show.

A vertical divider also gets aria-orientation="vertical", so screen readers announce which way it runs.

Subtle and strong

variant is subtle, the default, or strong.

ProfileSettings
Sign out
ProfileSettings
Sign out

subtle uses --color-border-subtle, the colour of dede’s own hairlines. strong uses --color-border-strong. Use strong when the line must be seen, for example between two groups that would otherwise read as one.

Inset

inset makes the line shorter. A number stops it the same distance short of both ends. text makes a vertical line as tall as the text beside it.

WorkAbout
Contact
inset="none"
WorkAbout
Contact
inset="3"
WorkAbout
Contact
inset="text"

A number is a --space-component-* step. A vertical line loses that much at the top and at the bottom; a horizontal one loses it at the start and at the end. It is not space around the line: the gap on either side stays the same.

Each row above is 40px tall with 14px text, as in a nav bar. With no inset the line is the full 40px. With inset="3" it is always 16px: 12px off each end, whatever the text’s size.

For a line exactly as tall as the text, use inset="text". The line is one line of the surrounding text tall and is centred in the row. It follows the text: here it is 19.6px on a wide screen and 17.6px on a phone, where the type is smaller. On a horizontal line, text does nothing, and the line fills the width as with none.

A colour of your own

Write a class in your own stylesheet and give it to the divider.

ProfileSettings
Sign out
/* your stylesheet */
.divider-brand {
    border-color: #6d28d9;
}

<Divider className="divider-brand" />

Divider’s colour rules have zero specificity, so your class wins whichever stylesheet loads first. Set border-color: the line is the divider’s top border when horizontal and its start border when vertical.