Tags

Tags are a way to apply multiple labels to an item.

Installation

npx love-ui@latest add tags

Usage

import { Tags, TagsTrigger, TagsValue, TagsContent, TagsInput, TagsList, TagsEmpty, TagsGroup, TagsItem } from "@/components/tags"
<Tags availableTags={availableTags}>
  <TagsTrigger>
    {selectedTags.map((tag) => (
      <TagsValue key={tag.id}>{tag.name}</TagsValue>
    ))}
  </TagsTrigger>
  <TagsContent>
    <TagsInput placeholder="Search tags..." />
    <TagsList>
      <TagsEmpty>No tags found.</TagsEmpty>
      <TagsGroup>
        {availableTags.map((tag) => (
          <TagsItem key={tag.id} value={tag.id}>{tag.name}</TagsItem>
        ))}
      </TagsGroup>
    </TagsList>
  </TagsContent>
</Tags>

Features

  • Built-in search input to filter through tags
  • Supports both controlled and uncontrolled usage
  • Fully customizable through className props
  • Automatically adjusts width based on parent container
  • Optional remove button for selected tags
  • Full keyboard navigation support through Command component
  • Shared state management through TagsContext

Examples

Create a tag

Filter available tags