- Implementation
- FilterBar Props
- Boolean Filter Props
- Single Select Filter Props
- Multi Select Filter Props
- Single Date Selection Filter Props
- Ranged Date Selection Filter Props
- Custom Filter Props
Beta FeatureThis feature is currently in beta, and needs to be imported from
@servicetitan/anvil2/beta.While we hope to minimize breaking changes, they may occur due to feedback we receive or other improvements. These will always be documented in the changelog and communicated in Slack.Please reach out in the #ask-designsystem channel with any questions or feedback!Common Examples
Standard Filters
filters object array to the FilterBar component. The component takes the object and builds the set of filters for you according to the design patterns. You can create a custom filter if needed, but there are currently 5 available prebuilt filter types to pick from:Boolean
Single Select
The item list for single select is populated and controlled by the implementing team. This includes any filtering that needs to be done when a search field is present.Simple ExampleWith Search ExampleSince population of the item list is controlled by implementing team, the Single Select search handler needs to have an empty search term conditional in it so the filter drawer draft state can properly reset the displayed items after selection but before applying the batch update.Multi Select
The item list for single select is populated and controlled by the implementing team. This includes any filtering that needs to be done when a search field is present.Simple ExampleWith Search ExampleSince population of the item list is controlled by implementing team, the Single Select search handler needs to have an empty search term conditional in it so the filter drawer draft state can properly reset the displayed items after selection but before applying the batch update.Single Date Selection
Range Date Selection
Custom Filters
buttonRender, drawerRender, and custom label to create a custom filter. Label’s for custom filters can either be a string or a string with a chip count. Custom filters can be used by themselves or as part of a combined filter array.Filters with Apply/Cancel Triggers
controlledFiltering is set to true, Apply and Cancel buttons appear at the bottom of single select, multi select, single date selection, range date selection, and custom filter button popovers to control updating. This setting has no impact on the Filter Drawer, which always submits as a batch update upon clicking Apply.Filters with Search Field
Toolbar.Search alongside FilterBar to include a search input with your filters. The search bar works independently from the filters themselves and has its own search props.Filters with Additional Toolbar Items
FilterBar alongside a Toolbar with Toolbar control options to have additional actions. The FilterBar and Toolbar are rendered as siblings and can be composed with Flex for layout.Overflow Modes
FilterBar overflow mode defaults to wrap. Set overflow="collapse" to collapse filters that do not fit within the available space.In collapse mode, a hidden filter does not get added to an overflow menu, it is only removed from the screen. All filters remain accessible through the filter drawer in any mode.React Accessibility
Aria Labels
Add anassociatedContent prop to the FilterBar for proper group identification for screen readers. The associatedContent value provides a11y context, generating labels like “Filters for ”.