- Implementation
- FilterBar Props
- Boolean Filter Props
- Single Select Filter Props
- Multi Select Filter Props
- Single Date Selection Filter Props
- Ranged Date Selection Filter Props
- Date List Filter Props
- Date List Option
- Async Select Filter Props
- Async Multi Select Filter Props
- Tree Filter Props
- Async Tree 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 several 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.Single select filters are backed bySelectMenuSync in the toolbar and SelectFieldSync in the drawer. Pass a static options array; client-side filtering happens automatically via match-sorter. To customize filtering, pass a filter function or a MatchSorterOptions config.Multi Select
Multi select filters are backed byMultiSelectMenuSync (toolbar) and MultiSelectFieldSync (drawer). Same options/filter model as single select, with selectedOptions as an array. selectAll and selectFiltered are supported and managed automatically — pass true (or { label }) to enable.Single Date Selection
Range Date Selection
Date List Selection
A Date List filter renders a single-select picker of date “buckets” that resolve to a concrete date or range. Pass the buckets you want asoptions; FilterBar automatically renders On…, Before…, After…,
and Custom Range… below them. Selecting a menu option opens a Dialog
with the appropriate date picker.value: null is treated as no filter applied — selecting it clears the filter and the trigger button shows only the filter label. The four menu option ids (on, before, after, customRange) are reserved — don’t reuse them in your own options.Async Select Selection
An Async Select filter is a single-select filter whose options are loaded asynchronously by yourloadOptions function. In the toolbar it renders as a popover-style menu backed by SelectMenu; in the drawer it renders as a labeled form field backed by SelectField. Both surfaces consume the same loadOptions configuration, including SelectMenu’s full lazy loader union (page, offset, group) and eager loading.singleSelect, or where the options are server-backed (typeahead lookups, dynamic catalogs, etc.). All optional SelectMenu configuration — pinned, cache, virtualize, disableSearch, displayMenuAs, groupToString, etc. — is accepted directly on the filter object.Async Multi Select Selection
An Async Multi Select filter is the multi-selection counterpart of Async Select — backed byMultiSelectMenu in the toolbar and MultiSelectField in the drawer. Same loadOptions configuration, same lazy loader union; the committed value is an array of selected options.selectAll and selectFiltered props from MultiSelectMenu are supported. Their onClick handlers are consumer-owned (you decide what “select all” means against your data source), and their checkState is derived from the current selectedOptions on each render — rebuild the filter object whenever the selection changes so the checkbox state stays in sync.Tree
A Tree filter selects nodes from a hierarchical, staticoptions tree. In the toolbar it renders a popover-style menu backed by TreeSelectMenuSync; in the drawer it renders a labeled form field backed by TreeSelectFieldSync. Client-side search happens automatically (parents of matches are preserved); customize it with a filter function or MatchSorterOptions config.selectedNodes — an array of node values, even in selectionMode: "single". All optional TreeSelectMenu configuration (selectionMode, valueConsistsOf, defaultExpandLevel, expandedIds, virtualize, disableSearch, displayMenuAs, popoverWidth, searchPlaceholder) is accepted directly on the filter object.Async Tree
An Async Tree filter is the asynchronous counterpart of Tree — backed byTreeSelectMenu in the toolbar and TreeSelectField in the drawer. Instead of a static options tree, you supply a loadOptions callback that is called for the root nodes and again with a parentNode for lazy branch expansion.selectedNodes, the same shape as the sync tree filter. All optional TreeSelectMenu configuration — cache, virtualize, displayMenuAs, initialLoad, selectionMode, valueConsistsOf, defaultExpandLevel, etc. — is accepted directly on the filter object.These filter types come with preset filter drawer variants.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.Drawer-only Filters
drawerOnly: true on any filter to keep it accessible only through the filter drawer. The filter never renders inline in the toolbar, even when there is room for it. The drawerOnly flag is available on every filter type — boolean, singleSelect, multiSelect, date, dateRange, dateList, asyncSelect, asyncMultiSelect, tree, asyncTree, numericRange, textInput, and custom.For a custom filter with drawerOnly: true, buttonRender is forbidden — only drawerRender is needed, since the filter never renders inline.The drawer’s “Filters” trigger appears whenever at least one filter is unreachable from the toolbar — that is, when a filter is drawer-only or the container is too narrow (below 640px) to show inline filters. When every filter fits inline and none are drawer-only, the trigger does not render.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.Clear Button
Single select, multi select, async select, async multi select, date, date range, and date list filters all render a “Clear” button in their popover footer. Clicking Clear resets the filter to its empty state, firesonFilterChange, and closes the menu. The behavior is built-in — the adapter wires up the clear handler, footer layout, and close behavior, and consumers cannot opt out per filter.Footer layout adapts to what else is present:- Clear alone — full-width row at the bottom of the popover.
- Clear + Apply/Cancel — Clear sits to the left of the Apply/Cancel row (multi select, async multi select, date, and date range filters when
controlledFilteringis on).
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.Responsive Behavior
FilterBar always wraps filters that don’t fit on a single line. Below a 640px container width, inline filters are hidden and only the drawer trigger is shown. Set disableCollapse to keep filters inline at every container width.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 ”.