Result state
The outcome of a whole task or page: a payment went through, an import failed, access is refused, a page does not exist. A large glyph or status code, a title, a sentence, the way out and an optional reference for support. For a list that is simply empty, use the empty state; for a passing note, a toast.
Install
npx shadcn@latest add @thrum-pro/result-stateThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Automatically installs icons circle-alert, circle-check, circle-x and info from the icon set.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
ResultState: status | "success" | "error" | "warning" | "info" | "403" | "404" | "500" | Default "info" | The outcome. The four words draw a 56 pixel glyph in the matching state colour; the three codes print the number, 48 pixels tall. |
ResultState: animated | boolean | Default false | Draw the glyph's strokes in once when it appears: the outline in 200 ms, then the mark. Codes do not draw. |
ResultState: headingLevel | 1 | 2 | 3 | 4 | 5 | 6 | Default 2 | The heading level of the title. A result that is the whole page usually takes 1. |
ResultState: icon | ReactNode | – | Replaces the glyph or the code with your own picture. It is hidden from screen readers. |
ResultState: sound | boolean | Default true | Play a sound once when the result appears, if the visitor has sound on: success, warning (also 403 and 404) or error (also 500). Info is silent. |
ResultState: ...props | ComponentProps<"div"> | – | Every other div attribute is passed through. className is merged last. |
ResultStateTitle | ComponentProps<"h2"> | – | What happened, 20 pixels and semibold, at the level headingLevel sets. |
ResultStateDescription | ComponentProps<"p"> | – | What it means and what to do now, at most 448 pixels wide. |
ResultStateActions | ComponentProps<"div"> | – | The way out, primary action first. The buttons wrap and stay centred. |
ResultStateDetails | ComponentProps<"div"> | – | A reference for support in a muted monospace box. Long ids break anywhere rather than overflow. |
Motion and sound
Motion
- With animated set, the glyph's outline draws itself in 200 ms and its mark follows 150 ms later. It happens once, when the result appears.
- Reduced motion: the glyph is complete from the first frame.
Sound
- When it appears: the success chime for success, the warning tone for warning, 403 and 404, the error tone for error and 500. Info is silent.
- It plays once, and again only if the status changes.
Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works
Accessibility
- The result has the status role: when it replaces the content of a page, a screen reader reads it without interrupting.
- The title is a real heading at the level headingLevel sets.
- The glyph and the code are hidden from screen readers: the title says what happened. Colour is never the only signal; each status has its own glyph or number.
- Glyphs keep 3 to 1 and text 4.5 to 1 against the page in both themes.
| Keys | Action |
|---|---|
| Tab | Move to the actions, primary first, then to anything inside the details. |
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/result-state.tsx- Packages
- None
- Brings along
- Chart foundationsSound engine
- Icons
circle-alertcircle-checkcircle-xinfo
Changelog
- 1.0.0 · 2026-12-03First release.