Skip to content
nexubDesign System
v11.9.0

Components · Data Display

Stage Counter

AlphaAdded v11.3.0

A row of selectable stat cards, each with a count and a failed count, that filters a list.

import { StageCounter } from '@nexub/react';
View as Markdown

Usage

Use it for
  • Counts per stage above a list of jobs, imports or orders, where pressing a stage filters the list.

Use something else for
  • Counts that do not filter anything: use StatCard.

  • Switching between views: use Tabs or SegmentedControl.

Playground

Props

  • Import #101 · Queued
  • Import #102 · Processing
  • Import #103 · In review
  • Import #104 · Done
  • Import #105 · Queued
TSX
<StageCounter aria-label="Filter imports by stage" stages={stages} value={stage} onValueChange={setStage} />

Examples

Filters a list

  • Import #101 · Queued
  • Import #102 · Processing
  • Import #103 · In review
  • Import #104 · Done
  • Import #105 · Queued

Several stages

Props

Props
PropTypeDefaultDescription
stagesrequiredStageCounterStage[]—{ value, label, count, failed?, tone? }. failed shows "3 failed" in the danger tone; tone colours the count.
valuestring | string[]—The selected stage, null for all. Pressing the selected stage again clears it.
defaultValuestring | string[]—The selected stage, null for all. Pressing the selected stage again clears it.
onValueChange((value: string) => void) | ((value: string[]) => void)—Called with the new stage, or null.
multipleboolean—Several stages at once: value is a string[], an empty array means all.
aria-labelstring—Names the group, e.g. "Filter by stage".

Accessibility

ARIA roles

`group` named by `aria-label`; each card is a toggle `button` with `aria-pressed`.

Keyboard

  • Tab

    Moves between the stages.

  • Enter / Space

    Selects or clears the stage.

Notes

  • The failed count is written out ("3 failed"), not shown by colour alone. Cards wrap on small screens.

On iOS & Android