Filter

Anatomy

Chip

Core form without functionality.

Companies

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.

Companies
Companies
Companies

Truncation

The Filter.Value component truncates text when it overflows (e.g. on smaller viewports).

An extremely unnecessarily long label

Empty State

Empty Operator

Ideally, Filter should never have an empty operator, but it can provide an empty state as a fallback.

Companies

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.

Companies

Composing with Select and Choice

In this example we tie it all together by composing:

  1. A Select component for Filter.Operator.
  2. A Choice component for Filter.Value.
Companies