Skip to content

Filters

⋯

Filters supplies layout and common controls for the Filters bar, dropdown editor, and slideout anatomy. It does not define filter fields, operators, query syntax, or data fetching.

Import Filters from @nesra/ui/filters or @nesra/ui. Compose its parts with Input, Select, DatePicker, Button, or other controls.

import { Filters } from "@nesra/ui/filters";
import { Input } from "@nesra/ui/input";
export function OrderFilters() {
return (
<Filters.Bar>
<Filters.Content>
<Input aria-label="Search orders" placeholder="Search orders" />
</Filters.Content>
</Filters.Bar>
);
}
Filters.Bar
├─ Filters.Content
│ └─ application controls or Filters.List
│ └─ Filters.Row
│ ├─ Filters.Fields (field, operator, value)
│ └─ Filters.Remove (optional)
└─ Filters.Actions (optional)

Filters.Bar wraps on narrow screens. Filters.Fields places its third child below the first two until the sm breakpoint.

This example follows the Figma bar’s search/select/action structure. The search and status values are controlled by the page.

The page keeps the desktop Tabs and mobile Select on the same controlled view value. The search field and status filter are also application state. Customize search toggles the search control.

All orders matching “any search” · any status

The compact date trigger opens the calendar presentation of DatePicker in a Popover. Completing a range or choosing a preset updates the trigger and closes the popup. The page owns sort order, status, and the committed range.

Date range

Rows can stay in the bar rather than opening an editor. Add, remove, clear, and apply remain page actions.

The Figma advanced pattern has a field, operator, searchable multi-value control, and remove action per row. Here, Popover handles the anchored editor and focus behavior. The example keeps draft rows separate from applied rows; the application decides which drafts are valid.

0 applied filters

The same row layout and MultiSelect value editor work inside Sheet.Content. Sheet.Header and Sheet.Footer provide the title and actions. Sheet manages focus, dismissal, and the backdrop.

Filters.Trigger can be passed to either Popover.Trigger or Sheet.Trigger through Base UI’s render prop.

The filter parts use the Figma Filters roles in both modes. Filters.List separates rows with --nesra-stroke-border. The Filters.Trigger count uses --nesra-surface-card-bg-neutral with a --nesra-stroke-border border. Keyboard focus on Filters.Trigger shows shadow-nesra-focus-ring-offset, the Figma Focused state: a 2px foundation-bg-neutral gap and a 4px focus ring. The slideout example inherits the Sheet backdrop: --nesra-foundation-bg-overlay at 70% with a 16px blur.

The Figma Filters sets are still marked as changed and unpublished. Hover and default fills for the trigger come from Button.

Filters.Bar groups Filters.Content and Filters.Actions. Filters.List stacks Filters.Row elements. Each row uses Filters.Fields for three application-supplied controls and can include Filters.Remove. Give every control a distinct accessible name, such as “Filter field 1” and “Filter value 1”, and give Filters.Remove a row-specific aria-label. The layout parts do not add keyboard behavior or form semantics; the composed controls provide those. Popover and Sheet retain their own disclosure, focus, and dismissal behavior.

MultiSelect supplies search, multiple-selection semantics, and bulk actions for the team value editors. The application still owns which value editor matches each filter field and how selected values become a query.

Wraps Filters.Content and Filters.Actions in a responsive flex container. It accepts native div props and className. Its ref points to the root div.

Grows around application-supplied controls and wraps them when necessary. It accepts native div props and className. Its ref points to the content div.

Groups application-supplied action buttons in a wrapping flex container. It accepts native div props and className. Its ref points to the actions div.

Stacks filter rows and renders a divider between adjacent children. It accepts native div props and className. Its ref points to the list div.

Aligns one Filters.Fields group with an optional Filters.Remove. It accepts native div props and className. Its ref points to the row div.

Lays out field, operator, and value controls in a responsive grid. It accepts native div props and className. Its ref points to the fields div.

Renders a Button for composition with Popover.Trigger or Sheet.Trigger through the render prop.

Prop Type Default Effect
children ReactNode "Filters" Sets the visible trigger label.
count number — Renders an applied-filter count when supplied.
showChevron boolean true Shows or hides the disclosure chevron.
size "sm" | "md" | "lg" | "icon-sm" | "icon-md" | "icon-lg" "sm" Sets the button dimensions.
variant "primary" | "outline" | "ghost" | "destructive" | "link" "outline" Sets the button appearance.

Filters.Trigger accepts the other Button props except startIcon and endIcon, including disabled, loading, onClick, render, and className. Its ref points to the button element.

Renders an icon-only Button. The application supplies the remove handler and a row-specific accessible name.

Prop Type Default Effect
aria-label string Required Names the row-specific remove action.
size "sm" | "md" | "lg" | "icon-sm" | "icon-md" | "icon-lg" "icon-sm" Sets the button dimensions.
variant "primary" | "outline" | "ghost" | "destructive" | "link" "ghost" Sets the button appearance.

Filters.Remove accepts the other Button props except children, startIcon, and endIcon, including disabled, loading, onClick, render, and className. Its ref points to the button element.