npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-filter-chips.json --yesFilter chips
ProThe row of filters applied to a list, under its filter controls, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- FilterChipOne filter in force, in a
FilterChipsrow
import { FilterChips, FilterChip } from '@/components/ui/goop/filter-chips';
import { useState } from 'react';
import { SearchInput } from '@/components/ui/goop/search-input';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem } from '@/components/ui/goop/dropdown-menu';
function TaskFilters() {
const [status, setStatus] = useState<string | null>('In progress');
const [owner, setOwner] = useState<string | null>('Bilal Rashed');
return (
<div className="flex flex-wrap items-center gap-2">
<SearchInput label="Search tasks" placeholder="Search tasks" className="w-64" />
<FilterChips
onClearAll={() => {
setStatus(null);
setOwner(null);
}}
>
{status === null ? null : (
<DropdownMenu>
<FilterChip field="Status" editAs={<DropdownMenuTrigger />} onRemove={() => setStatus(null)}>
{status}
</FilterChip>
<DropdownMenuContent align="start">
<DropdownMenuRadioGroup value={status} onValueChange={setStatus}>
<DropdownMenuRadioItem value="Planned">Planned</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="In progress">In progress</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="Done">Done</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
)}
{owner === null ? null : (
<FilterChip field="Owner" onRemove={() => setOwner(null)}>
{owner}
</FilterChip>
)}
</FilterChips>
</div>
);
}When to use
- The row of filters applied to a list, under its filter controls.
- Also called: filter pills.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Filter chips on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-filter-chips.json --yesAdd the Goop Filter chips to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { FilterChips, FilterChip } from '@/components/ui/goop/filter-chips';
import { useState } from 'react';
import { SearchInput } from '@/components/ui/goop/search-input';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem } from '@/components/ui/goop/dropdown-menu';
function TaskFilters() {
const [status, setStatus] = useState<string | null>('In progress');
const [owner, setOwner] = useState<string | null>('Bilal Rashed');
return (
<div className="flex flex-wrap items-center gap-2">
<SearchInput label="Search tasks" placeholder="Search tasks" className="w-64" />
<FilterChips
onClearAll={() => {
setStatus(null);
setOwner(null);
}}
>
{status === null ? null : (
<DropdownMenu>
<FilterChip field="Status" editAs={<DropdownMenuTrigger />} onRemove={() => setStatus(null)}>
{status}
</FilterChip>
<DropdownMenuContent align="start">
<DropdownMenuRadioGroup value={status} onValueChange={setStatus}>
<DropdownMenuRadioItem value="Planned">Planned</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="In progress">In progress</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="Done">Done</DropdownMenuRadioItem>
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
)}
{owner === null ? null : (
<FilterChip field="Owner" onRemove={() => setOwner(null)}>
{owner}
</FilterChip>
)}
</FilterChips>
</div>
);
}- Fits: list, board: toolbar.
- Also known as: ActiveFilters, AppliedFilters, FilterBar, FilterTags, DismissibleTag.
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| aria-label? | string = 'Active filters' | The row's name, read as the group's. |
| onClearAll? | () => void | Takes every filter off. |
| clearLabel? | string = 'Clear all' | The "Clear all" button's words. |
| returnFocus? | RefObject<HTMLElement | null> | Where the focus goes when no chip is left: your first filter control. |
| removedMessage? | (words: string) => string | What the status line says after a cross; <words> removed by default. |
| clearedMessage? | string = 'All filters cleared' | What the status line says after "Clear all". |
| disabled? | boolean = false | Every chip shown, dimmed, and none can be taken off. |
| children? | ReactNode | The chips: one FilterChip per filter in force. |
| Part | What it is |
|---|---|
| FilterChip | One filter in force, in a FilterChips row; its props: filter-chips--filter-chip.md |
- data-slot values (to select a part by): filter-chip, filter-chip-close, filter-chip-content, filter-chip-label, filter-chip-trigger, filter-chip-value, filter-chips, filter-chips-action, filter-chips-status
FilterChip
One filter in force, in a FilterChips row.
import { FilterChip } from '@/components/ui/goop/filter-chips';Options
- field?: ReactNode — What the filter narrows, before its value:
Status. - children: ReactNode — The filter's value:
In progress. - onRemove?: () => void — Takes this filter off (the caller's state drops it, and the chip with it).
- removeLabel?: string — The cross's spoken name;
Remove filter <field>: <value>by default. - onEdit?: () => void — Makes the chip's words a button that opens your editor for this filter (a sheet, a dialog).
- editAs?: ReactElement<{ asChild?: boolean; children?: ReactNode }> — Makes the chip's words the trigger of your editor: a
DropdownMenuTriggerorPopoverTriggerelement; the chip then sits inside that menu's or popover's root. - disabled?: boolean = false — Shown but not changeable: dimmed, no cross, its words no button.
Keyboard
| Key | What it does |
|---|---|
| Tab | Move to each chip's words (when they edit), its cross, then Clear all |
| Enter / Space on a cross | Take that filter off; the focus moves to the next chip, else the previous, else the caller's filter control |
| Enter / Space on Clear all | Take every filter off; the focus moves to the caller's filter control |
| Enter / Space on an editable chip's words | Open the caller's editor for that filter |
Accessibility
- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.