Skip to content

Data Input

Tokenizer

Token field for selecting multiple tagged values.

import { Tokenizer } from '@var-ui/react';

Tokenizer

Combo-style field that turns selected options into removable tags. Always controlled via value (an array of option values, like Select multiple) / onValueChange. Selected values are filtered out of the dropdown so you cannot add the same token twice.

Examples

Default

Pass options as { value, label, disabled? }[] and keep selected tokens in React state. Type to filter, pick from the list, or press Backspace on an empty input to remove the last tag.

Demo.tsxTSX
import { Tokenizer } from '@var-ui/react';

<Tokenizer label="Tags" options={options} value={value} onValueChange={setValue} />

Pre-selected tags

Seed value with one or more options to show an existing selection. Pair with description or errorMessage for field chrome.

Alpha
Gamma

Start with a few tokens already selected

Demo.tsxTSX
import { Tokenizer } from '@var-ui/react';
import { useState } from 'react';

const options = [
  { value: 'alpha', label: 'Alpha' },
  { value: 'beta', label: 'Beta' },
  { value: 'gamma', label: 'Gamma' },
  { value: 'delta', label: 'Delta' },
];

const [value, setValue] = useState(['alpha', 'gamma']);

<Tokenizer
  label="Tags"
  description="Start with a few tokens already selected"
  options={options}
  value={value}
  onValueChange={setValue}
/>

Sizes

size (sm, md, lg) sets the minimum height, inset and input type, matching TextField; tokens step one font size down. It falls back to the surrounding control size (InputGroup, Toolbar, Select.Root), then md.

Props

Accessibility

Built on React Aria ComboBox plus TagGroup / TagList. The group exposes a labeled remove control on each chip (Remove {label}). Keep label visible so the field and the selected-tag list share a clear accessible name; use description / errorMessage for the same helper and validation copy sighted users see. Keyboard: arrow through suggestions, Enter to add, Backspace on an empty input removes the last token.