Filter Bar
Basic Usage
Loading...
Installation
pnpm add @corew500/uiUsage
import { FilterBar } from "@corew500/ui/filter-bar"
<FilterBar>Content</FilterBar>Variants
filterBarVariants
| Axis | Values | Default |
|---|---|---|
| spacing | smdefaultlg | default |
filterItemVariants
| Axis | Values | Default |
|---|---|---|
| variant | defaultpillsoutline | default |
| size | smdefaultlg | default |
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| filters* | FilterOption<T>[] | — | Filter options to display |
| showAll | enum | true | Whether to show the "All" option |
| allLabel | string | All | Label for the "All" option |
| showCounts | enum | false | Whether to show count badges |
| variant | enum | default | Visual variant for filter items |
| size | enum | default | Size of filter items |
| spacing | enum | default | Spacing between filter items |
| ariaLabel | string | Filters | Accessible label for the toolbar |
| className | string | — | Additional CSS classes |
| multiple | enum | false | Enable multi-select mode |
| value* | enum | — | Currently selected filter values Currently selected filter value |
| onChange* | enum | — | Callback 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