WellSourced

Filter chip

A toggleable filter, used in horizontal rows above search results and on category pages.

Usage#

  • Chips are AND filters, not OR pills. Tapping two chips narrows results. Make that obvious with an inline result count when scope permits.
  • Active is ink, not teal. Active chips use ink-on-sand so they don't compete with the single teal primary action on the page.
  • Keep labels tight. One to three words. “Organic cotton”, “Family-owned”, “Workshop made”.
  • Order matters. Most common first, alphabetical second. Never “surprise me” random.

Props#

NameTypeDefaultDescription
activebooleanfalseWhether the filter is currently applied.
onToggle(next: boolean) => voidCalled when the user toggles the chip.
countnumberOptional count rendered in monospace at the right.
children*ReactNodeFilter label.

Code#

tsx
import { FilterChip } from "@/components/ui/FilterChip";

<FilterChip>Organic cotton</FilterChip>
<FilterChip active>Japanese denim</FilterChip>
<FilterChip count={124}>Workshop made</FilterChip>

// Controlled
const [active, setActive] = useState(false);
<FilterChip active={active} onToggle={setActive}>Family-owned</FilterChip>