Skip to content
synccn

Filter Chips

New

Toggleable filter pills with counts and a Clear action.

  • Fix focus ring in Select
  • Dark mode for Code Diff

Installation

$ pnpm dlx shadcn@latest add @synccn/filter-chips

First time in this project? Connect synccn with one command.

Usage

import { FilterChips } from "@/components/ui/filter-chips";<FilterChips options={statuses} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

FilterChips

Toggleable filter pills with counts and a "Clear" action. options: [{ value, label, count?, icon? }]

  • optionsrequired
    { value: string; label: React.ReactNode; count?: number; icon?: React.ElementType }[]

    Filters.

  • value
    string[]

    Controlled selection.

  • defaultValue
    string[]

    Default []

    Initial selection when uncontrolled.

  • onValueChange
    (value: string[]) => void

    Called with the new selection.

  • multiple
    boolean

    Default true

    Allow several filters at once.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

  • lib/utilscn (merges class names)
  • lib/hooksuseControllable (works controlled or uncontrolled)

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: group
  • ARIA attributes: aria-pressed
  • Shows a visible focus ring for keyboard users