GitHub

Filter Bar

Horizontal filter bar with single/multi-select and count badges

Basic Usage

Loading...

Installation

pnpm add @corew500/ui

Usage

import { FilterBar } from "@corew500/ui/filter-bar"

<FilterBar>Content</FilterBar>

Variants

filterBarVariants

AxisValuesDefault
spacing
smdefaultlg
default

filterItemVariants

AxisValuesDefault
variant
defaultpillsoutline
default
size
smdefaultlg
default

API Reference

Props

PropTypeDefaultDescription
filters*FilterOption<T>[]Filter options to display
showAllenumtrueWhether to show the "All" option
allLabelstringAllLabel for the "All" option
showCountsenumfalseWhether to show count badges
variantenumdefaultVisual variant for filter items
sizeenumdefaultSize of filter items
spacingenumdefaultSpacing between filter items
ariaLabelstringFiltersAccessible label for the toolbar
classNamestringAdditional CSS classes
multipleenumfalseEnable multi-select mode
value*enumCurrently selected filter values Currently selected filter value
onChange*enumCallback when selection changes

Accessibility

Keyboard Navigation

  • Keyboard: Tab to enter, arrow keys to navigate (TODO: implement roving tabindex)
  • Focus visible rings for keyboard navigation

Screen Readers

  • - Uses `role="toolbar"` with `aria-label` for screen readers
  • Each filter is a button with `aria-pressed` state

Localization

Translatable Content

  • - `allLabel` can be translated for the "All" option
  • Filter `label` values should be pre-translated

Related

Related Components