Skip to content
VenusUI
Get started

Tag Input

Add tags with Enter or comma and remove them with Backspace or their buttons.

Preview

Installation

npx shadcn@latest add @venusui/tag-input

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/tag-input.tsx

Usage

The code behind the preview above.

tag-input-demo.tsx

import { TagInput } from "@/components/ui/tag-input"

export default function TagInputDemo() {
  return <TagInput label="Skills" defaultValue={["React", "TypeScript"]} max={6} className="max-w-sm" />
}

API reference

PropTypeDefaultDescription
labelstring—Visible label. Required.
valuestring[]—Controlled tags.
defaultValuestring[][]Initial tags when uncontrolled.
onValueChange(tags: string[]) => void—Called when tags change.
maxnumber—Maximum number of tags.
placeholderstring"Add a tag…"Input placeholder.

Only the props above, plus className.

Requirements

  • lucide-react, React 19 and Tailwind CSS v4.

Customization

  • Duplicates and empty tags are ignored; adjust add in the file for other rules.
  • Leaving the field also adds what was typed.

Accessibility

  • A real label; each tag has a “Remove X” button; additions and removals are announced.

Troubleshooting

Commas inside tags.
A comma adds the tag. Remove that branch in onChange if tags may contain commas.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A text field whose label sits inside and floats above on focus or when filled.

Loading preview

A number field with minus and plus buttons, clamped to a range.

Loading preview

OTP Input

Inputs

One-time code entry in separate boxes with paste, autofill and keyboard navigation.