Note: This project is still in development and has not been publicly released. Coming soon.
Docs
Tags Input
Tags Input

A flexible tag input component with multiple trigger keys, variants, and Zod validation support.

15 views
2 downloads
Loading...

Overview

The Tags Input component enables efficient collection and management of multiple text values with an intuitive tagging interface, essential for categorization, keyword entry, and multi-value form fields. It supports various trigger keys (Enter, Space, Comma), configurable limits, and both default and pill variants with comprehensive validation. Perfect for skill tags, categories, search filters, and any scenario requiring organized multi-value input with excellent user experience.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/tags-input.json

Usage

1"use client"
2
3import { TagsInput } from "@/registry/inputs/tags-input"
4
5export function Component() {
6 return (
7 <TagsInput
8 label="Skills"
9 name="skills"
10 description="Add your technical skills"
11 triggerKey="Enter"
12 maxTags={10}
13 onChange={(tags) => console.log("Tags:", tags)}
14 />
15 )
16}

API Reference

Props

PropTypeDefaultDescription
labelstring-Label text for the input (required)
namestring-Form field name for submission (required)
descriptionstringundefinedDescription text below the label
hintstringundefinedHint text below the input
errorstringundefinedError message to display
requiredbooleanfalseWhether the field is required
pendingbooleanfalseWhether the field is in a loading state
defaultValuestring[][]Default tags array (uncontrolled)
valuestring[]undefinedControlled tags array
disabledbooleanfalseWhether the input is disabled
idstringnameID for the input element
variant"default" | "pill""default"Input styling variant
coloredBorderbooleanfalseShow colored border (pill variant only)
labelVariant"default" | "muted""default"Label text styling variant
containerClassNamestring""CSS classes for the container
labelClassNamestring""CSS classes for the label
triggerKey"Enter" | "Space" | "Comma""Enter"Key that triggers tag addition
maxTagsnumberundefinedMaximum number of tags allowed
schemaZodType<string[]>undefinedZod schema for validation
onValidate(isValid: boolean, value: string[], error?: string) => voidundefinedValidation callback
onChange(tags: string[]) => voidundefinedCallback when tags change

Examples

Pill Variant

Rounded pill variant with muted background styling for modern interfaces.

Loading...

Max Tags Limit

Tag input with maximum limit enforcement and validation feedback.

Loading...