Serafim

Tag Selector

Forms 48

About

A versatile component for selecting and creating multiple tags with search functionality and keyboard navigation support.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Tag Selector to your project and fits it to your theme.

Code

How Tag Selector is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useState } from "react"
import { TagSelector } from "@/components/ui/tag-selector"

interface Tag {
  id: string
  label: string
}

function TagSelectorDefault() {
  const availableTags: Tag[] = [
    { id: "1", label: "React" },
    { id: "2", label: "TypeScript" },
    { id: "3", label: "JavaScript" },
    { id: "4", label: "Next.js" },
  ]

  const [selectedTags, setSelectedTags] = useState<Tag[]>([])

  return (
    <TagSelector
      className="max-w-[400px]"
      availableTags={availableTags}
      selectedTags={selectedTags}
      onChange={setSelectedTags}
      getValue={(tag) => tag.id}
      getLabel={(tag) => tag.label}
      createTag={(label) => ({ id: crypto.randomUUID(), label })}
    />
  )
}

function TagSelectorWithPreselected() {
  const availableTags: Tag[] = [
    { id: "1", label: "React" },
    { id: "2", label: "TypeScript" },
    { id: "3", label: "JavaScript" },
    { id: "4", label: "Next.js" },
  ]

  const [selectedTags, setSelectedTags] = useState<Tag[]>([
    availableTags[0],
    availableTags[1],
  ])

  return (
    <TagSelector
      className="max-w-[400px]"
      availableTags={availableTags}
      selectedTags={selectedTags}
      onChange={setSelectedTags}
      getValue={(tag) => tag.id}
      getLabel={(tag) => tag.label}
      createTag={(label) => ({ id: crypto.randomUUID(), label })}
    />
  )
}

export default {
  TagSelectorDefault,
  TagSelectorWithPreselected,
}

Dependencies

More by Serafim

View all
  • Spline Scene

    Spline Scene

    9.5K
  • Testimonials with Marquee

    Testimonials with Marquee

    2.3K
  • Gradient Button

    Gradient Button

    2K
  • Pixel Canvas

    Pixel Canvas

    912
  • Animated Blur Number

    Animated Blur Number

    832
  • Empty State

    Empty State

    781
  • Balloons

    Balloons

    767
  • Status Badge

    Status Badge

    661

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Login 1

    Login 1

    53
  • Form

    Form

    137
  • Card Studio

    Card Studio

    41
  • Modern & Stunning sign in

    Modern & Stunning sign in

    1.6K
  • SignInPage

    SignInPage

    667