Filter
Anatomy
Chip
Core form without functionality.
Tip
All children of the Filter component require an explicit key for animation purposes — you can autogenerate one with the useKey hook from @o/pipeline/utils/hooks.
Multiple Values
When there is more than 1 value, the Filter.Value component should display a count of the values and, in most cases, omit the icon.
Truncation
The Filter.Value component truncates text when it overflows (e.g. on smaller viewports).
Empty State
Empty Operator
Ideally, Filter should never have an empty operator, but it can provide an empty state as a fallback.
Empty Value
Ideally, Filter should be removed completely from the DOM when its value is empty, but it can provide an empty state as a fallback.
This will be rendered when the value is null, undefined, or an empty string.
Composing with Select and Choice
In this example we tie it all together by composing:
- A
Selectcomponent forFilter.Operator. - A
Choicecomponent forFilter.Value.