Status
The state of an order, a delivery or an invoice, in words with a colored mark. The hue sits in the dot and the tint; the text stays at a reading level, so it passes AA anywhere.
- Native HTML
- 1.1 KB gzipped · script and styles
@orbex/sonar-components/status
Examples
Code
import { Status } from '@orbex/sonar-components/status'
export default function Dots() {
return (
<>
<Status tone="positive">Delivered</Status>
<Status tone="warning">Due today</Status>
<Status tone="danger">Delayed</Status>
<Status>Scheduled</Status>
</>
)
}
Code
import { Status } from '@orbex/sonar-components/status'
export default function Chips() {
return (
<>
<Status appearance="chip" tone="positive">Paid</Status>
<Status appearance="chip" tone="warning">On hold</Status>
<Status appearance="chip" tone="danger">Overdue</Status>
<Status appearance="chip">Draft</Status>
</>
)
}
Sizes, variants and states
Usage
- Positive: done, paid, delivered. Warning: pending, on hold, due today. Danger: delayed, overdue, canceled. Neutral: scheduled, draft.
- Use the chip where status text would sit on a container: colored text does not reach 4.5:1 there.
- One word or two. The detail goes in the panel the row opens.
Do and don’t
Accessibility
Keyboard
| Key | What it does |
|---|---|
| None | Status is text, not a control. |
Roles and attributes
| Element or attribute | What it gives |
|---|---|
| Text | The state is always written, so it never depends on color. |
| Dot | aria-hidden. |
Notes
- Color never carries the state alone: the word always names it.
- The mark is hidden from assistive technology.
Use it
Each component is its own entry point with its own stylesheet, so an app loads only what it uses. The tokens and the cascade layers are set once for the app: see Installation.
import { Status } from '@orbex/sonar-components/status'
import '@orbex/sonar-components/status.css'
API
| Prop | Type | Default |
|---|---|---|
tone
What the state means. Color never carries it alone: the text always names it. |
'neutral' | 'positive' | 'warning' | 'danger'
|
'neutral' |
appearance
A dot beside the text, for rows and lists; or a chip, for headers and for containers, where colored text would not reach 4.5:1. |
'dot' | 'chip'
|
'dot' |
hideLabel
Only the dot shows; the state stays in the text for assistive technology. For dense rows where a tooltip or the row’s details name the state, as in the overview’s calendars. |
boolean
|
false |
children
Required
The state in words: Delivered, Delayed, Due today. |
ReactNode
|
— |
Also takes every attribute of the native <span>
, and a ref to it.