Token input
Text with tokens in it, such as a message that mentions people and attaches files, where each token is deleted, selected and copied as one piece.
Examples
Default
A reply that mentions people and attaches files. Type @ for suggestions from a Trigger menu inside it; the buttons insert at the caret through actionsRef.
Token deletion
tokenDeletion sets what Backspace does beside a token: removes it, selects it first, or turns it back into its text.
Loading and unresolved
A token’s status: pending shows a spinner after 200ms, and unresolved a dashed edge until someone says which one it is.
Submit shortcut
With submitShortcut="mod+enter", Enter starts a new line and ⌘ Enter or Ctrl Enter calls onSubmit.
In a form
In a Field, its label names the field and an invalid field marks it. name sends the value in the codec’s text, such as [@Maya Chen](mention:maya).
Read only
readOnly keeps the text and its tokens as they are; they can still be selected and copied.
Installation
npx shadcn@latest add https://kinoui.com/r/token-input.json- Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/trigger-editor.tsxlib/chip.tsxlib/field-control.tsxlib/run-progress.tslib/highlight.tslib/flow.tslib/announce.tsxcomponents/kino/input.tsxcomponents/kino/textarea.tsxcomponents/kino/token-input.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
TokenInput
Data attributes
Accessibility
- The field is a multiline
textbox. Name it with aFieldand its label, which focuses it, or witharia-label. - A token is one character to the caret: the arrow keys step over it, Shift+arrow selects it, and Backspace or Delete acts on it whole.
- A screen reader reads each token’s label with its description, such as “Maya Chen, mentioned”, and hears each token added or removed, and an upload that finishes.
- Undo and redo are the field’s own, so tokens come back whole: ⌘Z or Ctrl+Z, and ⌘⇧Z or Ctrl+Y.
- A read-only field is announced as read only, and ⌘A or Ctrl+A selects its text to copy.
- When the system asks for less motion, tokens fade in and out without scaling.