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

Badge

A short label in a pill: a number, a status, a word.

import { Badge } from "@dede-style/ui/badge", then <Badge>1</Badge>. It is plain text, read with whatever it sits beside: no role, no focus, nothing to press.

1

One size, 24px tall, and never narrower than it is tall. So one character is a circle and a word is a pill, from the same component with nothing to choose. The fill carries the emphasis: every variant has the same size and weight.

Two props set the look. variant says how much the badge stands out: quiet, the default, or strong. tone says what it means: neutral, the default, or one of the four statuses. The text is always regular weight.

Circle and pill

A number beside the label it belongs to, quiet and strong, and the same component holding a word.

1A³ Tool2Matching3Pricing
NewNew

quiet sits back on a wash with the secondary text colour; strong is the inverse surface, so it stands out in either mode. Above, strong marks the current item and quiet the rest.

The look is a prop, never the parent’s state. A tab that is current picks variant="strong" for its badge; the badge does not read aria-current off its parent.

Tone

The four status tones, quiet on the first row and strong on the second. They use the status colours dede already has in both modes.

BetaShippedDeprecatedRemoved
BetaShippedDeprecatedRemoved

A quiet status badge has a pale tint of the status colour behind a darker shade of it. The text measures at least 5.6:1 against the tint in light mode and 6.4:1 in dark mode.

The quiet row is shown with border on, because in light mode it needs it. The light tints are almost the same tone as the page (1.01 to 1.03:1), so without the border a quiet status badge looks like coloured text rather than a pill. In dark mode the tint shows the shape better on its own.

A strong status badge is filled with the darker shade and has the inverse text colour. The text measures at least 5.7:1 in light mode and 7.3:1 in dark mode. check:contrast checks every one of these pairings in both modes.

Border

The border is off by default. Set border to draw one.

DraftDraft4

A quiet neutral badge is a very light wash, and on a dark sunken background it is hard to see. A border gives it a visible shape. A quiet neutral badge uses --color-border-strong for its border, which measures about 2:1 against the page in both modes. A status badge uses its own status border colour.

The border is drawn inside the badge, so it takes no room. A badge is the same size with or without it, and a single character is still a 24px circle.

A strong badge has no border, because its solid fill already marks its edge. You can pass border to a strong badge, but nothing changes.

A label wider than its container

Cut with an ellipsis at the container’s edge, rather than crossing it.

Awaiting review from the design team

A safety net, not a feature. Badge labels are short, and a badge has no maximum width of its own: the container sets the measure. There is no title on a cut label either; if cut text ever needs revealing, that is a tooltip’s job.

A colour of your own

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

New
/* your stylesheet */
.badge-new {
    background-color: #6d28d9;
    color: #ffffff;
}

<Badge className="badge-new">New</Badge>

dede has no colours beyond its greys and the four status colours, so a brand colour comes from your own class rather than from a prop. Badge’s own colour rules have zero specificity, so your class wins whichever stylesheet loads first.

dede only verifies contrast for its own colours. If you set your own, checking their contrast in both modes is up to you.