Krizaka
Documentation

Tag selector

Interests, languages, what one is looking for: toggle chips with a limit and a count — the others rest once the limit is reached.

Web + MobileBêtaFormulaires

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

Quand l’utiliser

  • A profile's interests, up to five.
  • Filters by topic with a limit.

Quand ne pas l’utiliser

Installation

Installer

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

Styles

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

Importer

import { TagSelector } from "@krizaka/ui/tag-selector";

Exemples

Interests

Ten interests, up to five.

3 of 5 chosen

Props

Toggle chips with a limit and a count — the others rest once the limit is reached.

PropTypeDéfautDescription
labelrequisstring—The group's name (“Interests”) — passed translated.
onValueChangerequis(value: string[]) => void—Called with the tags chosen.
optionsrequisreadonly TagOption[]—The tags offered.
valuerequisreadonly string[]—The tags chosen.
classNamestring—Classes merged on the root.
countLabel((count: number, max: number) => string)—The count under the tags: (n, max) => n + " of " + max.
maxnumber—The most that can be chosen.

Accessibilité

  • A group named by label; each chip says whether it is chosen; the count is announced.

Clavier

TouchesAction
Tab / SpaceReach and toggle each chip.

Bonnes pratiques

  • Say the limit in the count (“3 of 5 chosen”).
  • Order the options by popularity, not alphabet.

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

Sur cette page