Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Sheet examples · Form

Search and Filter Sheet for React

A right-side filter sheet with a search field, three category checkboxes and an Apply Filters button.

Framework
UI library

Filters that slide in from the right: a search field, three category checkboxes under a Categories legend, and Apply Filters. The list behind stays where it was, and people go back to it once they've applied.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How are the categories grouped?

In a FieldSet whose FieldLegend reads Categories. Each category is a horizontal Field with the checkbox first and its label after, so clicking the label toggles the box.

Does Apply Filters filter anything?

Not yet: the checkboxes are uncontrolled and the button has no handler. Read the values when it's pressed, apply them to your list, and close the sheet.

How do I close the sheet after applying?

Control the open state and set it to false in the Apply handler: Pass open to Sheet; onOpenChange receives the next boolean.

How does Filters open the sheet?

The outline button labeled Filters is the trigger, and its text is the accessible name. The Button goes in the render prop of SheetTrigger, and the label stays its child.

What does the filter sheet announce?

SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. It reads Search & Filter, with Refine your search with filters below as the description.