Chip
A selectable pill: alone a toggle, in a group a single or multiple choice, or a removable tag. Also the tags of a workspace: TagChip, with a colour marker from the closed palette.
- Domaine
- Fondations
- Niveau de support
- Taille
- 3.7 kB gzip, budget 13.0 kB
- Qui l'utilise
- 21 fichiers des produits et sites en production l'importent (Verikora : 4, Folioviv : 3, Sovkora : 3, krizaka.com : 2) Compté dans l'inventaire daté du 2026-11-23.
import { Chip, TagChip, TagMarker, MarkerPicker } from "@krizaka/ui/chip";<Chip removeLabel="Remove">Subtitles</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 Sovkora, Verikora, Folioviv, krizaka.com.
Quand l’utiliser
- To filter a list with a few short options shown at once: format, genre, speed.
Chip.Group type="multiple"for several tags;type="single"(withrequired) for one filter.removablefor the values already chosen: tags, recipients, active filters.TagChipfor the tags a person puts on a file (a client, an invoice, an applicant): the name with its marker, a dot or a ribbon.MarkerPickerrecolours one from the six colours.
Quand ne pas l’utiliser
- To switch between views of the same page.À la place : Tabs
- To choose in a form that is submitted, with labels that read as sentences.À la place : Radio group
- For the state of an entity whose kind has a status set.À la place : Status chip
- For a status that cannot be changed.À la place : Badge
- To run an action.À la place : Button
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { Chip, TagChip, TagMarker, MarkerPicker } from "@krizaka/ui/chip";Exemples
Toggle
Alone, off and on: a pressed button.
Single choice
One choice in a group: a filter; required keeps one chosen.
Multiple choice
Several choices: tags.
Small
size="sm" for dense toolbars.
Removable
Chosen tags, each with a named remove button.
Tags with a marker
TagChip: a client's tags as a filter, and worn tags with a ribbon marker, removable.
Recolour a tag
MarkerPicker: the six colours of the closed palette, named and ticked.
Props
Chip
Chip (selectable, removable) and Chip.Group (single · multiple).
| Prop | Type | Défaut | Description |
|---|---|---|---|
onRemoverequis | () => void | — | Runs when the remove button is pressed. |
removeLabelrequis | string | — | The accessible name of the remove button — passed translated, e.g. "Remove #night". |
defaultSelected | boolean | — | Alone: pressed at first, uncontrolled. |
onSelectedChange | ((selected: boolean) => void) | — | Alone: called with the new state on every press. |
removable | boolean | — | A pressable chip (the default); true makes it a static chip with a remove button.
A static chip (a chosen tag, an applied filter) with a remove button. |
selected | boolean | — | Alone: pressed or not (defaultSelected uncontrolled), onSelectedChange on every press. |
size | "sm" | "md" | md | sm · md (inside Chip.Group, the group's size by default). |
value | string | — | Inside Chip.Group: the value this chip stands for (required there, ignored alone). |
ChipGroup
Chips that choose together: type single · multiple, value/defaultValue + onValueChange.
| Prop | Type | Défaut | Description |
|---|---|---|---|
typerequis | "single" | "multiple" | — | One choice: the chips behave as radios. Any number of choices: the chips are pressed buttons. |
defaultValue | string | string[] | — | The value chosen at first, uncontrolled. The values chosen at first, uncontrolled. |
disabled | boolean | — | Disables every chip of the group. |
label | string | — | The group's accessible name — passed translated ("Filter by format"). |
loop | boolean | — | Arrow keys wrap from the last chip to the first (default true). |
onValueChange | ((value: string) => void) | ((value: string[]) => void) | — | Called with the new value on every choice. Called with the new values on every press. |
orientation | "horizontal" | "vertical" | — | The arrow keys that move: left / right (horizontal, a row) or up / down (vertical, a column). |
required | boolean | — | Keeps one chip selected: pressing the selected chip does not clear it (default false). |
routeKey | string | — | Binds the choice to this search parameter of the URL (?type=…): the URL is the state. Without it the state is local — only for an ephemeral choice. |
routeValues | readonly string[] | — | The values the parameter may hold (the chips' values). |
size | "sm" | "md" | md | sm · md: the size of every chip of the group. |
value | string | string[] | — | The chosen value (controlled), "" when none.
The chosen values (controlled). |
MarkerPicker
Recolours a tag from the closed palette: a radio group of swatches (arrow keys), the chosen one ticked and named.
| Prop | Type | Défaut | Description |
|---|---|---|---|
labelrequis | string | — | The group's accessible name ("Colour of the tag"), passed translated. |
namesrequis | Readonly<Record<"blue" | "green" | "amber" | "red" | "violet" | "gray", string>> | — | The name of each colour, passed translated: { blue: "Blue", … }. The swatches are named, never colour alone. |
className | string | — | Classes merged on the root. |
defaultValue | "blue" | "green" | "amber" | "red" | "violet" | "gray" | — | The colour chosen at first, uncontrolled. |
disabled | boolean | — | Not available. |
markers | readonly ("blue" | "green" | "amber" | "red" | "violet" | "gray")[] | ["blue", "green", "amber", "red", "violet", "gray"] as const | The colours offered (default: the six). |
onValueChange | ((value: "blue" | "green" | "amber" | "red" | "violet" | "gray") => void) | — | Called with the colour chosen. |
showNames | boolean | false | Writes each colour's name beside its swatch (44 px targets, wrapping): a sighted person who cannot tell two hues apart still reads « red » and « amber ». |
value | "blue" | "green" | "amber" | "red" | "violet" | "gray" | — | The colour chosen (controlled). |
TagChip
A tag: its marker and its name. Alone a toggle (a filter), inside Chip.Group an item, or removable (a tag worn by a
file) — the behaviour of Chip, with the marker before the name.
| Prop | Type | Défaut | Description |
|---|---|---|---|
markerrequis | "blue" | "green" | "amber" | "red" | "violet" | "gray" | — | The tag's marker: a name of the closed palette (blue · green · amber · red · violet · gray). |
onRemoverequis | () => void | — | Runs when the remove button is pressed. |
removeLabelrequis | string | — | The accessible name of the remove button — passed translated, e.g. "Remove #night". |
defaultSelected | boolean | — | Alone: pressed at first, uncontrolled. |
onSelectedChange | ((selected: boolean) => void) | — | Alone: called with the new state on every press. |
removable | boolean | — | A pressable chip (the default); true makes it a static chip with a remove button.
A static chip (a chosen tag, an applied filter) with a remove button. |
selected | boolean | — | Alone: pressed or not (defaultSelected uncontrolled), onSelectedChange on every press. |
shape | MarkerShape | dot | dot · ribbon. |
size | "sm" | "md" | md | sm · md (inside Chip.Group, the group's size by default). |
value | string | — | Inside Chip.Group: the value this chip stands for (required there, ignored alone). |
TagMarker
The marker alone, decorative (aria-hidden): put the tag's name beside it.
| Prop | Type | Défaut | Description |
|---|---|---|---|
markerrequis | "blue" | "green" | "amber" | "red" | "violet" | "gray" | — | A name of the closed palette. |
shape | MarkerShape | dot | dot · ribbon. |
Accessibilité
- Radix Toggle and ToggleGroup: alone
aria-pressed; in a single group a radio (aria-checked), in a multiple group pressed buttons. Chip.Grouptakeslabelas the group's accessible name.- The remove button is a separate button named by
removeLabel. - A marker is decorative (
aria-hidden); the tag's name is the chip's name.MarkerPickeris a radio group of named swatches (arrow keys), the chosen one ticked;showNameswrites each name beside its swatch (44 px targets, wraps).
Clavier
| Touches | Action |
|---|---|
| Tab | Moves into the group (one tab stop) and out of it. |
| Arrow keys | Move between the chips of a group. |
| Space / Enter | Toggles the focused chip. |
Bonnes pratiques
- One or two words per chip; the group's
labelsays what is being chosen. - Keep the order stable when a chip is selected: do not move it to the front.
- Give each removable chip a
removeLabelthat names it: “Remove #night”, not “Remove”. - A marker sits beside the name and never fills the chip: the colour is never the only signal. Keep tag names short; the closed palette has six colours, the tokens
--kz-tag-<name>and--kz-tag-<name>-text(≥ 3:1 and ≥ 4.5:1 on every surface).
Composants liés
Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub