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 + MobileBetaForms

Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.

When to use

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

When not to use

Installation

Install

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

Styles

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

Import

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

Examples

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.

PropTypeDefaultDescription
labelrequiredstring—The group's name (“Interests”) — passed translated.
onValueChangerequired(value: string[]) => void—Called with the tags chosen.
optionsrequiredreadonly TagOption[]—The tags offered.
valuerequiredreadonly 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.

Accessibility

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

Keyboard

KeysAction
Tab / SpaceReach and toggle each chip.

Best practices

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

Generated from the code of @krizaka/ui 3.5.0: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page