FailureMosaic
Failures by group. Each column is as wide as its share and split by failure kind. Point at a column to read it alone.
Failed requests
By region · 2.4K failures
Share of failuresWidth = volume
02.4K failures
- Timeout41%
- Rate limited34%
- Server error25%
Installation
Run this in a project that has a components.json. It adds one file, components/tenor-ui/failure-mosaic.tsx, and no packages.
pnpm dlx shadcn@latest add https://tenor.design/r/failure-mosaic.jsonNo components.json? Fetch the file. It works in any React project.
curl --create-dirs -o src/components/tenor-ui/failure-mosaic.tsx https://tenor.design/r/failure-mosaic.tsxUsage
Every prop is optional. With none, it renders the content you see above.
<FailureMosaic />import { FailureMosaic } from "@/components/tenor-ui/failure-mosaic";
export function CheckoutFailures() {
return (
<FailureMosaic
title="Failed checkouts"
groupedBy="provider"
groups={[
{ label: "Stripe", count: 1340, shares: [52, 31, 17] },
{ label: "Adyen", count: 860, shares: [38, 44, 18] },
{ label: "PayPal", count: 410, shares: [27, 35, 38] },
]}
kinds={[
{ label: "Timeout", share: 44 },
{ label: "Declined", share: 36 },
{ label: "Server error", share: 20 },
]}
failureRate={3}
caption="Failed / of checkouts"
/>
);
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
title | string | "Failed requests" | Heading of the panel. |
groupedBy | string | "region" | What the failures are grouped by, as it reads after "by". |
groups | readonly FailureMosaicGroup[] | failureMosaicGroups | One column per group. Their counts add up to the total. |
kinds | readonly [FailureMosaicKind, FailureMosaicKind, FailureMosaicKind] | failureMosaicKinds | The three failure kinds, top to bottom in each column, with their shares of all failures. |
failureRate | number | 6 | Percent of all requests that failed. |
caption | string | "Failed / of requests" | Line beside the total and the failure rate. |
labels | Partial<FailureMosaicLabels> | failureMosaicLabels | Replaces the panel's wording, key by key. |
locale | string | "en-US" | Locale used to format the counts. |
accent | string | "#FF6B00" | Colour of the first failure kind. |
theme | "dark" | "light" | "dark" | Colour palette. |
It also takes every attribute of its root element, such as className and style.
Theming
Set any of these CSS variables on the component or on an ancestor. Each falls back to the look shown here.
--tui-surface--tui-stroke--tui-text--tui-muted--tui-accent--tui-on-accent--tui-segment--tui-pattern-ground--tui-font-mono