Token input (UI SDK): Custom codec
A codec turns tokens into text and back, here as <@id>. With copy="label", copying writes what people read, and pasting back still restores the tokens.
Ping @hollis and @ines about the launch
Ping <@hollis> and <@ines> about the launch
This adds the example as components/examples/ui-sdk-token-input/codec.tsx, together with the Token input component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-token-input-codec.jsonTo add only the component, follow the Token input installation.
Props in this example
The Token input props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
defaultValue | TokenInputValue | – |
onValueChangeRuns on typing, pastes, menus, undo and controller calls. details lists the reason and any removed tokens. | (value, details) => void | – |
copy | "codec" | "label" | "codec" |
codec | TokenCodec | – |
Every prop is in the Token input API reference.
See them all, with keyboard support and accessibility notes, on the Token input page.
- CalendarA date grid for single, range and multiple selection, with sliding months, range previews and touch-sized days.
- CheckboxA checkbox whose check draws in, with indeterminate parents, groups and labels that share its hover.
- ComboboxA filterable select with chips, groups and async results, in a popup that resizes as you type.
- Date pickerA button that opens a calendar in a popover, or a bottom sheet on phones, for single dates and ranges.
- FieldLabels, descriptions and errors wired to their control, with validation states and layouts for forms.
- InputA text input with three sizes, invalid and read-only states, native validation styling and a 16px touch font so phones never zoom in.