You are currently on Anvil1, which is now in maintenance mode. Visit Anvil2 to get the latest version of the design system.
components / Actions and Inputs

Filter Button

Variants

Default

Icon only

Expandable

Single Select

Multi Select

Custom Range Input

Custom Date Range


Behavior

Default selection

In the case where a filter or sort option does not have an off state, but instead a default option, the Filter Button is shown as non-active when the default option is selected. As an example, when sorting content where the default order is alphabetical A→Z, the Filter Button should appear non-active when that option is selected, since it is the default.

All Filters

Selecting an option from All Filters should also update the related Filter Button when available. This also works visa versa, if filter was applied by an individual Filter Button, it should also reflect the selection on All Filter button.


Usage Guidelines

Icon usage

Refrain from using icon only variant but when you do need one, make sure the icon is obvious for everyone.

Text Overflow

  • Label and value combined, text length should be less than 20 characters.
  • If longer than 20 characters, only use the active state as indicator. This includes any range picking filter, like a date range.
  • Multi-select Filter Buttons should use an active state badge to show how many items are turned on.

Responsiveness

We have three options to handle a set of Filter Buttons.

  • Remove the filter buttons as needed and to rely on All Filter Button (recommended for desktop experience)
  • Wrap the filter button the next line
  • Make filter button set horizontally scrollable (recommended for touch device experience)

Table

When using with table, use table's column sort instead of adding filter button for sorting.


Content Guidelines

Give filters descriptive names

Labels of filter categories and values should be easy to understand. When a filter name is ambiguous on its own, add a descriptive word related to the status.

For example, Low doesn’t make sense out of context. Add the word “risk” so that know it’s related to risk.

Use “Apply Filter” for button text when saving filter configuration

“Apply Filter” is descriptive of the action being taken and will make the button name consistent across the platform.


Accessibility

Keyboard Interactions

Under-the-hood, this is a button and supports all button keyboard interactions.

Labeling

label is always required for this component because it is using it as aria-label internally for better accessibility. This can be overwritten if you pass your own aria-label prop.


Importing

import { FilterButton } from '@servicetitan/design-system';