Charcoal UI

Tag Input

Type and press Enter or comma to add chips. Backspace highlights the last chip first, then removes it on the second press.

  • Category: Inputs
  • Licence: Free, MIT
  • Built with: React 19, Tailwind CSS 4, Motion
  • Dependencies: motion, clsx, tailwind-merge

Examples

Tag Input

API reference

PropTypeDefaultDescription
value / defaultValuestring[]—
onValueChange(tags: string[]) => void—
labelstring—
maxnumberInfinity
placeholderstring—

About Tag Input

Tag Input turns typing into chips: press Enter or a comma to add one, and Backspace highlights the last chip before removing it, so nobody deletes a tag by accident. Chips pop in and out on springs.

Tag Input is an input component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.

When to use Tag Input

  • Tags and labels on posts, tasks and files.
  • Email recipients and invite lists.
  • Skills and interests in profiles.
  • Keyword lists in search and filter tools.

How it works

The two-step Backspace is the detail that matters: the first press marks the chip, the second removes it. A max prop caps the count, duplicates are ignored, and the list is announced to screen readers as it changes.

It is a real form control: it has an accessible name, works with the keyboard alone, shows a visible focus ring and announces its state to screen readers. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.

Customizing Tag Input

Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.

The Customize panel next to the preview lets you change label, placeholder, max live, and the Code tab updates to match, so the snippet you copy already carries your values.

  • value / defaultValue (string[]).
  • label (string).
  • max (number, default Infinity).
  • placeholder (string).

Goes well with Tag Input

These inputs pieces share its tokens and motion language, so they sit together on one page without clashing.

  • Range Slider: Six animated React range sliders on one accessible core: inline, tick, fluid, wave, bubble and ruler
  • Button: An animated React button with six variants, spring press feedback and a width-stable loading state
  • Switch: An animated React toggle switch whose thumb stretches when pressed, like a real switch
  • Checkbox: An animated React checkbox: the check draws itself in, the box pops, indeterminate morphs to a dash
  • Radio Group: An animated React radio group with roving focus and a highlight that glides between card options

Install Tag Input

npx shadcn@latest add https://charcoalui.com/r/tag-input.json

Tag Input is free and MIT licensed. The command copies tag-input.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.

It pairs well with Gooey, a Pro piece: Liquid UI: pieces that touch melt into one another and stretch apart like goo, while text and icons stay perfectly crisp. An SVG filter plus springs, so it works with any markup.

Frequently asked questions

How do I install Tag Input?
Run npx shadcn@latest add https://charcoalui.com/r/tag-input.json. The shadcn CLI copies tag-input.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
Is Tag Input free for commercial use?
Yes. Tag Input is MIT licensed: use it in any personal or commercial project and change it however you like.
Does Tag Input work with Next.js?
Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
Can an AI coding agent install Tag Input?
Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Tag Input's props and source and get_install_command returns the exact command.

Tag Input as Markdown · llms.txt