Krizaka UI
Krizaka UI
Composants

Status chip

A state of a status set (@krizaka/organize, krizaka-ts#89): its label in the person's language and its tone as a badge; read-only, or a menu of the moves the role may make — a second press to confirm, a reason picked from a list.

Web · ✓Mobile · ✓Bureau · ✓BêtaAffichage de données
import { StatusChip } from "@krizaka/ui/status-chip";

Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.

Pourquoi il est là. Used by Yomizaka, Akinaza.

Quand l’utiliser

  • The state of an entity whose kind has a status set the admin configures: an applicant file (« To decide → Selected | Declined »), a client, an invoice.
  • In a table column or a detail header: read-only for a derived set (an invoice's « Paid » comes from the ledger), editable where the role may move it.

Quand ne pas l’utiliser

  • For a status that is not a set of the product (an upload, a build, a plan).À la place : Badge
  • For a tag the person puts on a file (a category of their own).À la place : Chip
  • To choose among views of a list.À la place : Tabs

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Importer

import { StatusChip } from "@krizaka/ui/status-chip";

Exemples

Status of an applicant file

« To decide » with its moves for the owner (a second press for « Selected », a reason picked for « Declined »), the same state read-only for another role, and a derived status.

Props

The state of a status set as a badge; a menu of the allowed moves when the set, the role and onMove allow it.

PropTypeDéfautDescription
localerequis"fr" | "en"—The language the labels are read in.
rolerequisstring—The role of the person: the moves are the ones this role may make.
setrequisStatusSet—The kind's status set (KindConfig.status).
staterequisstring—The key of the entity's state.
classNamestring—Classes merged on the badge.
labelsPartial<StatusChipLabels>—The words of the menu, passed translated.
onMove((move: StatusMove) => void)—Called when a move is chosen (confirmed, with its reason when it asks for one). Without it the chip is read-only.
size"sm" | "md"smsm · md.

Accessibilité

  • Read-only, it is plain text with a dot: the label says the state, the tone is never the only signal.
  • With moves it is a button named « Change the status, now … » that opens a Radix menu (arrows, typeahead, focus return).
  • The « Confirm: … » text is a polite live region.

Clavier

TouchesAction
Enter / Space / Arrow DownOpens the menu of moves.
Arrow keysMove between the moves; Arrow Right opens the reasons of a move.
EnterMakes the move, or on a move to confirm, asks « Confirm: … » first.
EscCloses the menu and returns to the chip.

Bonnes pratiques

  • Pass the kind's StatusSet as it is (KindConfig.status), the entity's state key and the person's role: the menu is movesFrom(set, state, role), in the set's order — never your own list of moves.
  • A move that asks to be confirmed (transition.confirm) turns into « Confirm: … » on the first press. A move with reasons opens the list to pick from: there is never a free-text reason.
  • After a move that is not to a final state, offer an undo (a toast) with undoOf(set, move, role); after a final state there is none.
  • A status never takes a tag's colour: the tone (neutral · accent · success · warning · danger) is a tint and a dot, and the label always says the state.
  • A status column sorts by statusOrder(set), never alphabetically.

Générée depuis le code de @krizaka/ui 3.63.1 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page