Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Status for React

A small colored dot for React on Base UI that marks a state beside its label, such as online or failed, in five theme colors and three sizes.

On this page9 sections

A status is a small colored dot that marks the state of something next to its name: a teammate who is online, a build that failed, a service running slowly. It comes in five colors and three sizes, and screen readers skip it, so the word beside it carries the meaning.

When the label is the message, such as Beta or a count, use a Badge, which can hold a dot too. For a status that should read as live, Status Pulse Text pulses a ring around its dot.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Status anatomy: badge, status, text

Usage

import { Status } from "@/components/ui/status";
<div className="flex items-center gap-2 text-sm">
  <Status variant="success" />
  <span>Online</span>
</div>

Accessibility

Status renders a span with aria-hidden="true", so a screen reader skips it, and its color says nothing to someone who can't tell red from green. Put the state in words beside the dot, as the Usage example and the Variants demo do. When the dot has to stand alone, add the words in a span with the sr-only class, or give the dot role="img" and an aria-label and set aria-hidden to false, which overrides the component's own value.

Demos

Variants

A list of services, each row giving its state as a dot and a word: Operational in success, Running in info, Degraded in warning, Down in destructive and Paused in default. This is the dot's everyday job, where the word carries the meaning and the color lets people scan the column for the one row that needs them.

Preview width

Sizes

The three presets, sm, md and lg, make the dot 8, 10 and 12 pixels across, shown here beside 12, 14 and 16 pixel text. md is what you get with no size at all. Match the dot to the line it sits on, and use a size class only past lg, as in Custom size.

Preview width

Custom color

Three dots colored amber, teal and purple by a background class on each, with variant set to default. The class replaces the variant's fill because the dot merges your classes with its own, and the size and the ring stay. Use it when your product already has a color for a state none of the five variants match, such as away or in a meeting.

Preview width

Custom size

Three dots at 16, 24 and 32 pixels, set by the size-4, size-6 and size-8 classes, in the success, info and warning colors. A size class replaces the preset's width and height, for a dot beside a large heading or in a legend. The ring stays 2 pixels at every size, so it looks thinner on a big dot.

Preview width

Size lg

One info dot with size set to lg, 12 pixels across, the largest preset. Pick it beside a page or card title, or when the dot holds an icon, since the smaller presets shrink a glyph to 8 pixels or less. In a table row it can look heavier than the text next to it.

Preview width

Size md

The md size makes the info dot 10 pixels across, which is also what you get with no size at all. It sits well beside body text in a list or a table cell, where most status dots end up. Write the prop out only when you want the choice visible in the markup.

Preview width

Size sm

At sm the info dot is 8 pixels across. That is the size the With badge demo uses, where a larger dot would crowd the label, and it suits a dense list too. Alone in open space it is easy to miss, so keep a word beside it.

Preview width

Variant default

One dot in the default variant, filled with the theme's foreground color, the same as body text. It carries no status hue, so use it for a neutral or idle state, such as a draft or a member who is away, where green would claim more than is true.

Preview width

Variant destructive

Set variant to destructive and the dot takes the theme's destructive red. Keep it for failure: a build that broke, a service that is down, a payment that bounced. Spent on a mild delay, it stops standing out on the day something really fails.

Preview width

Variant info

The info variant fills the dot with the --info blue that installing Status adds to your theme. Use it for work under way that needs nothing from anyone: a sync running, a review open, a deploy in progress. When someone has to step in, move to warning.

Preview width

Variant success

One dot with variant set to success, in the --success green from your theme. It is the state people scan a list for: online, passing, up. Keep it for that, not for a selected row or a highlight, or a column of green dots stops saying anything.

Preview width

Variant warning

A warning dot takes the --warning amber from your theme, for the ground between fine and failed: a review pending, a quota near its limit, a service running slowly. Switch to destructive once something has failed, and don't spend amber on every small note.

Preview width

With badge

Four outline badges, Online, In progress, Pending and Offline, each with a small dot before the word in the success, info, warning and destructive colors. The badge stays outline, so the dot is the only color and the word says the rest. Use this for a status column in a table or on a card, where the state needs a container.

Preview width

With icon

A large dot in the default variant with a plus icon inside, which the dot sizes to four fifths of its width, about 10 pixels, so it fits. The icon is hidden from screen readers along with the dot, so it can't be the only sign of what it means. Use it for a small mark, such as add or verified, next to text that says the same.

Preview width

FAQ

Should I use a Status dot or a Badge?

Use a Status dot when the state sits next to text that already names it, such as a teammate's name with a green dot and the word Online. The dot has no text of its own and takes about 10 pixels, so it adds a signal people catch at a glance without taking room.

A Badge is a label with words in it, and it suits a state that needs a container, like a column of Paid and Overdue. The two combine: put a small dot inside an outline badge, as the With badge demo does.

What colors does the Status dot come in?

Five, set with variant. default uses the theme's foreground color for a neutral state, destructive uses the theme's destructive red, and info, success and warning are a blue, a green and an amber. With no variant, the dot is default, and the Variants demo shows all five, each beside its word.

The last three read the --info, --success and --warning variables, which installing Status adds to your theme's CSS for light and dark mode. In dark mode, destructive switches to --destructive-foreground, a red the install also sets. Change one of them there and every dot of that kind follows.

How do I give a Status dot a custom color?

Add a background class, such as bg-amber-500, and leave variant at default, as the Custom color demo does. The dot merges your classes with its own, so yours replaces the variant's fill while the size and the ring stay.

For a color you'll use again, add a key to statusVariants in components/ui/status, which is your code once installed. Give it a background and a text color for any icon inside, then pass its name as variant.

How do I change the size of a Status dot in React?

Set size to sm, md or lg, which make the dot 8, 10 or 12 pixels across. md is the default, and the Sizes demo shows the three beside text of the size each suits.

For any other size, add a size class such as size-4, as the Custom size demo does, and it replaces the preset's width and height. An icon inside grows with it, since the dot sizes an icon to four fifths of its own width unless the icon has a size class of its own.

How do I make a Status dot accessible to screen readers?

Write the state in words next to it. Status renders with aria-hidden="true", so a screen reader skips the dot, and its color alone doesn't reach anyone who can't see it or can't tell red from green. The word Online beside a green dot says it to everyone.

Where there's no room for a visible word, put one in a span with the sr-only class next to the dot. Or let the dot speak for itself: give it role="img" and an aria-label such as Online, and set aria-hidden to false, which overrides the component's own value.

How do I show a Status dot on an Avatar?

Use AvatarBadge from Avatar with a color class such as bg-success. It places itself on the avatar's bottom end corner, sizes itself to the avatar, and draws a ring in the page background so it stands clear of the photo.

Status works there too if you place it yourself: make the wrapper relative and the dot absolute at the bottom corner. Either way the dot is silent, so put the presence in words for screen readers, in the image's alt text or in a span with the sr-only class.

Why does my Status dot have a white ring around it?

The dot draws a 2-pixel ring in the page's background color, so it looks cut out where it overlaps an avatar or a busy surface. On a surface of another color, such as a muted panel or a card that differs from the page, that ring shows as a thin halo in the page's color.

Match it to the surface with a ring color class such as ring-card or ring-muted, or remove it with ring-0. Your class replaces the default, because the dot merges classes rather than adding to them.

Can I put an icon or a number inside a Status dot?

An icon fits at the lg size. Put it inside the dot as its child, as the With icon demo does with a plus, and the dot sizes any icon without a size class of its own to four fifths of its width, about 10 pixels at lg, 8 at md and 6 at sm. Below lg, most icons are too small to make out.

A number fits badly, since the largest preset is 12 pixels across and the dot's text is 10. For a count, use a Badge with pill and a size of lg, which draws a circle around one digit. Whatever you put inside, the dot hides it from screen readers, so say it in text too.

API Reference

Status

<span> data-slot="status-indicator"

PropType
size?"lg" | "md" | "sm"

The size.

Type
"lg" | "md" | "sm"
Default
"md"
variant?"default" | "destructive" | "info" | "success" | "warning"

The visual style.

Type
"default" | "destructive" | "info" | "success" | "warning"
Default
"default"
asChild?boolean

Use the provided child element as the default rendered element, combining their props and behavior.

className?string

Merged with the part's classes.

AttributeType
data-size?string

Mirrors size.