Skip to main content

FilterChip

BasicSelection<co-filter-chip>

FilterChip toggles a quick filter above a list, such as Rejected or Needs Review, and can show a count.

import { FilterChip } from 'health-components';

Examples​

Showcase​

Storybook

Removable​

Storybook

Without Check​

Storybook

Disabled​

Storybook

Usage​

<FilterChip selected={f.rejected} count={12} onChange={on => setF({ ...f, rejected: on })}>Rejected</FilterChip>

When to use​

  • Quick filters over a table or queue.
  • Removable active filters (with onRemove).

When not to use​

  • Mutually exclusive views: SegmentedControl or Tabs.

Variants and states​

VariantWhat it is
offOutlined pill.
onPrimary fill with check.
countNumber bubble.
removablex button to clear.
disabled45% opacity.

Accessibility​

  • aria-pressed shows the state; the check icon adds a non-colour cue.

Do and don't​

  • Do: "Rejected 12" over the claims queue.
  • Don't: Chips that each open a different screen.

Props​

PropTypeDefaultDescription
children *ReactNode—Label. Required
selectedboolean—On state (controlled)
defaultSelectedbooleanfalseInitial on state (uncontrolled)
countnumbernoneCount after the label
checkbooleantrueShow the check icon when on
onRemove() => voidnoneMakes a removable (applied) chip with an x button
removeLabelstring"Remove filter <label>"Accessible name of the remove button
onChange(on: boolean) => voidnoneCalled with the new state

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, disabled, name, value, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-filter-chip>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-filter-chip selected default-selected [defaultValue]="defaultValue" (co-remove)="onRemove($event.detail)">…</co-filter-chip>
KindNameDescription
attributeselectedOn state (controlled)
attributedefault-selected / defaultSelectedInitial on state (uncontrolled); default false
attributecountCount after the label; default none
attributecheckShow the check icon when on; default true
attributeremove-label / removeLabelAccessible name of the remove button; default "Remove filter <label>"
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
attributedisabled
attributename
property / JSON attributevalue
eventco-removeMakes a removable (applied) chip with an x button; default none (React: onRemove)
eventco-changeCalled with the new state; default none (React: onChange)
slot(default)Label. Required