DirectoryFast
  • 🚀Get Started
  • 🔤Tutorials
    • Bring me to life!
    • How it's structured?
    • Make it yours
    • Bonus
  • 🛠️Features
    • AI
      • AI URL Scanner & Scan Jobs
    • Analytics
    • Authentication
    • API
      • Protected Endpoints
    • Blog
    • Database
    • Emails
    • Error Pages
    • Icons
    • Payments
    • Private Pages
    • SEO
  • 📦General Components
    • Shadcn/ui Components
    • Navbar
    • Footer
    • SignIn Modal
    • Hero Section
    • Social Proof
    • Collections Social Proof
    • Featured Section
    • Latest Collections Section
    • Latest Products Section
    • Recommended Section
  • 📦Directory Components
    • Product Card
    • Collection Card
    • Product Note
    • Search Bar
    • Tags
    • Product Options Toggle
    • Combobox
    • Multi-Combobox
    • Submit Product
    • Feature Product
    • Manage Note
    • Manage Collection
    • Dashboard Tables
  • ⛓️Links
    • GitHub Repository
    • Support
Powered by GitBook
On this page
  1. Directory Components

Tags

Filter products by

PreviousSearch BarNextProduct Options Toggle

Last updated 22 days ago

  • Component: and related tag components

  • Path: /components/shared/tag-selector.tsx

  • Import:

import { TagSelector } from "@/components/shared/tag-selector";

A tag system that lets you categorize and filter products. Tags are colored badges that you can click to select/deselect.

Main Components:

  1. TagSelector:

  • Props:

    • selectedTags: string[] - Currently selected tag slugs

    • onChange: (tags: string[]) => void - Called when tags are selected/deselected

  • Features:

    • Shows tags as clickable colored badges

    • Switches to dropdown if you have more than 10 tags

    • Shows loading spinner while fetching tags

  1. ProductTags: import { ProductTags } from "@/components/shared/product-tags";

Props:

  • tags: ExtendedProductTag[] - Tags to display

  • limit?: number - How many tags to show (default: 3)

  • showAll?: boolean - Show all tags instead of limiting

  • Features:

    • Shows tags on product cards

    • Shows "+X more" if there are hidden tags

    • Clicking tag navigates to tag page

  1. Admin Management: Path: /dashboard/admin/tags

  • Features:

    • Create tags with custom colors

    • Edit existing tags

    • Assign tags to products

    • Delete tags

Example usage in main-layout.tsx:

// For filtering products
const [selectedTags, setSelectedTags] = useState<string[]>([]);
<TagSelector selectedTags={selectedTags} onChange={setSelectedTags} />

// For displaying on a product
<ProductTags tags={product.tags} limit={3} />

By default, tag search bar will only display when there's more than 10 tags.

📦
Tag Selector