Skip to content
Thrum

Tags input

A field for free-text tags: labels, keywords, email recipients. Anything can be typed and becomes a tag. When the tags must come from a known list, use the multi-select instead.

Install

npx shadcn@latest add @thrum-pro/tags-input

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
type Tags = string[];
Sample
const tags = [
  "billing",
  "onboarding",
  "q4-launch",
];

Props

PropTypeDefaultDescription
valuereadonly string[]–The tags, when the parent holds them. Use it with onValueChange.
defaultValuereadonly string[]Default []The tags at first, when the field holds them itself.
onValueChange(tags: string[]) => void–Called with the whole new list when tags are added or one is removed.
maxnumber–The most tags the field takes. Past it, new text stays in the field and the message says Up to 5 tags.
validatestring–A regular expression, as text, that every tag must match from start to end. A tag that does not match stays in the field to be fixed.
invalidMessagestringDefault '“{tag}” does not match the format'What to say when a tag does not match validate. {tag} is replaced by the tag.
size"sm" | "md" | "lg"Default "md"28, 32 or 40 pixels tall. The field grows a row at a time as the tags wrap.
soundbooleanDefault truePlay a soft sound when tags are added and when one is removed, if the visitor has sound on.
namestring–The form field name. Each tag is sent as its own value under it.
disabledbooleanDefault falseDimmed; nothing can be typed or removed.
readOnlybooleanDefault falseThe tags show without remove buttons, and nothing can be added.
placeholderstring–Shown while there are no tags.
classNamestring–Classes for the root element. The field fills its width.
…input propsComponentProps<"input">–id, aria-label and the rest go to the text input.

Motion and sound

Motion

  • Newly added tags fade and scale in from 92% over 150 ms; removed tags leave in one frame so remaining tags settle immediately.
  • The remove buttons and the field's border change colour over 150 ms. Reduced motion: every change happens at once.

Sound

  • A soft rising sound when tags are added, once per Enter, comma or paste however many tags it adds.
  • A soft falling sound when a tag is removed.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • The text field takes its name from a label element or an aria-label.
  • Each tag has a remove button named Remove and the tag's text.
  • A refused tag is explained in a polite live region linked to the field: already added, does not match, or the limit.
  • A pasted list is split at commas and line breaks; each piece is checked on its own.
  • A long tag is cut with an ellipsis and keeps its full text in a tooltip. The field wraps tags onto new rows at 160 pixels wide.
KeysAction
Enter / ,Turn the typed text into a tag. Enter in an empty field is left to the form.
BackspaceIn the empty field: select the last tag. On a tag: remove it and return to the field.
DeleteOn a tag: remove it.
← / →From the start of the field, move onto the tags, then between them. Past the last tag, back to the field.
Home / EndOn a tag: go to the first tag, or back to the field.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/tags-input.tsx
Packages
None
Brings along
Sound engineTag

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor