Skip to content
GitHub (opens in a new tab)

FilterButton

Filter chip for lists and tables: shows the filter name or its chosen value, opens its options, and turns an applied filter on or off.

stableMoleculecontracts/filterbutton.json

Preview

FilterButton

Filter chip for lists and tables. Same chrome as a secondary Button. Applied shows a kit Count in ink. With onToggle the name turns the filter on or off. Not Button. Not Badge.

Master

Status filter with two values applied. Click it to open. Variants shows the other states.

Usage

Pass count for applied values. Do not write the number into the label. Compose kit Count; do not invent a split button.

Do's

  • Filters above a table or list, like Status, Owner, or Date
  • A filter the user can keep but switch off for a moment, without losing what they picked

Don'ts

<FilterButton
  count={2}
  onClick={() => {}}
>
  Status
</FilterButton>

When to use

  • Filters above a table or list, like Status, Owner, or Date
  • A filter the user can keep but switch off for a moment, without losing what they picked

When not to use

  • Page actions or view switches — use Button, SplitButton or DropdownMenu
  • Status or category labels that are not filters — use Badge
  • A number without a filter name — use Count

What an agent reads

import { FilterButton } from "agentic-ds-kit";
must
  • Nothing set: one native button with aria-haspopup=menu and aria-expanded
  • Split: the name is a toggle button with aria-pressed; the chevron is a separate button named {children} options, with aria-haspopup and aria-expanded
  • Its name is the filter name or Name: value, plus the count, like Status, 3 filters applied
  • Each button has its own focus ring
defaults
  • size md
  • open false
  • disabled false
  • count 0
  • hasDropdown true
stops if
  • Do not invent a local split button, filter chip, or dropdown trigger — FilterButton is the split control for filters, and SplitButton is the one for actions
  • Do not use for page actions or view switches — use Button, SplitButton or DropdownMenu
  • Do not put more than one word or two in the name
  • Do not show the count as text in the label — pass count and compose kit Count
  • Do not invent FilterChip or FilterTrigger
  • Do not use raw hex or primitive --color-* ramps

From contracts/filterbutton.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
childrenstringYes—Filter name, like Status.
sizesm | md | lgNomdHeights from control-height: sm 32, md 36, lg 40, the same as Button, Input and Select. The chevron part is square.
openbooleanNofalseOptions are open. Sets aria-expanded and turns the chevron.
disabledbooleanNofalse—
countnumberNo0Applied values, like 3 statuses. Above 0 the filter is set and shows a kit Count.
valuestringNo—The chosen value. Shows as Status: Pending, the name quieter than the value.
toggleon | offNo—On or off once a filter is set. Leave it out and a set filter is on. Off keeps the selection but does not apply it: dashed outline on the page canvas fill, muted count.
onTogglefunctionNo—() => void. With a filter set, the name part becomes its own button that turns it on or off, and only the chevron opens the options.
hasDropdownbooleanNotruefalse: a plain on/off chip with no chevron, for filters with no value to pick. Clicking it calls onToggle.
onClickfunctionNo—Opens the options: the whole button when nothing is set, or the chevron once it splits.
  • Component
    →

    Button

    Clickable action control with appearance × mode (plus an optional flat set) and a fixed set of sizes.

  • Component
    →

    SplitButton

    A main action joined to a chevron that opens a menu of related actions.

  • Component
    →

    DropdownMenu

    Actions or value menu from a button, field, or nav trigger.

  • Component
    →

    Badge

    Compact read-only status or category pill set by the system.