Rating Filter

Rating

About this component

Rating Filter

Star rows for minimum-rating filtering in the familiar n-and-up pattern. Clicking the active row clears the selection.

Usage

The import and the props worth knowing about, in one place.

import { FilterRating } from "@/components/beste/component/filter-rating";

<FilterRating
  label="Rating"
  defaultValue="4"
  onChange={(value) => console.log("minimum rating:", value)} // null when cleared
  options={[
    { label: "4 & up", value: "4" },
    { label: "3 & up", value: "3" },
  ]}
/>

Playground

Turn the props on the right; the snippet under them is what you would write to get what you see.

Rating

Usage
import { FilterRating } from "@/components/beste/component/filter-rating";

<FilterRating
  label="Rating"
  className="w-56"
  defaultValue="4"
  options={[{"label":"4 & up","value":"4"},{"label":"3 & up","value":"3"},{"label":"2 & up","value":"2"}]}
/>

Keyboard and gestures

Every one of these is in the component already. They are listed because a props table cannot mention a gesture, so nothing else on this page can tell you they exist.

Arrow keysMove through the options. A radio group is one tab stop, so the arrows are how you get around inside it.
SpaceTake the focused option.

Props

Read from the component's own type, so this cannot drift from what it accepts.

PropTypeDefaultDescription
labelstringOptional group heading rendered above the rows
optionsFilterRatingOption[]
valuestring | nullControlled selection; omit to let the component manage its own state
defaultValuestringInitial selection when uncontrolled
allowClearbooleanClicking the active row clears the selection (default true)
onChange(value: string | null) => void
classNamestring

More Filter components

View all Filter

Gender

Segmented Filter

Single-select segmented control built on Tabs for mutually exclusive choices like gender or condition. Clicking the active segment clears the selection.

Size

Multiselect Filter

Dropdown with checkbox rows and a selection-count badge. Keeps many-option filters compact in toolbars where a checkbox list would not fit.

Fit

32
14
21

Radio Filter

Single-select radio list with optional result counts. Clicking the active option clears the selection, so the filter is always escapable.

Category

42
24
10
8
38
12

Tree Filter

Hierarchical checkbox tree for nested categories with expand/collapse rows. Checking a parent checks its whole subtree, and partially selected parents turn indeterminate.

Price

to

Min/Max Range Filter

Paired number inputs for open-ended ranges: either side can stay empty, so users can filter by only a minimum or only a maximum.

Deals

Toggle Filter

Switch rows for boolean product flags like on-sale or in-stock. Multi-select, works controlled or uncontrolled.