Skip to content
Browse components

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
  • Timeout
  • Rate limited
  • Server error

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.json

No 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.tsx

Usage

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

PropTypeDefaultWhat it does
titlestring"Failed requests"Heading of the panel.
groupedBystring"region"What the failures are grouped by, as it reads after "by".
groupsreadonly FailureMosaicGroup[]failureMosaicGroupsOne column per group. Their counts add up to the total.
kindsreadonly [FailureMosaicKind, FailureMosaicKind, FailureMosaicKind]failureMosaicKindsThe three failure kinds, top to bottom in each column, with their shares of all failures.
failureRatenumber6Percent of all requests that failed.
captionstring"Failed / of requests"Line beside the total and the failure rate.
labelsPartial<FailureMosaicLabels>failureMosaicLabelsReplaces the panel's wording, key by key.
localestring"en-US"Locale used to format the counts.
accentstring"#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