EQTY Lab Equality

Radio Dropdown

Dropdown for single-choice filtering with counts

View as Markdown

Overview

Radio Dropdown is a compact control for picking a single option from a list — typically a filter such as a status or category. It renders as a Button showing the current selection, opening a Dropdown Menu of radio options. Each option can carry an optional count, shown as a Badge on the trigger and inline in the menu, which is handy for surfacing how many items match each filter.

It is a controlled component: you provide the options and the selectedValue, and it calls onSelect when the user chooses a different one. Options with an empty value or label are filtered out automatically.

Usage

Import the component:

tsx
import { RadioDropdown } from "@eqtylab/equality";

Hold the selected value in state and update it from onSelect:

tsx
const [status, setStatus] = useState("active");

<RadioDropdown
  label="Status"
  options={[
    { value: "active", label: "Active", count: 5 },
    { value: "archived", label: "Archived", count: 2 },
  ]}
  selectedValue={status}
  onSelect={setStatus}
/>;

The label is shown on the trigger before anything is selected, and as the heading inside the menu. Once an option is selected, its label replaces the trigger text.

Default

Props

NameDescriptionTypeDefaultRequired
labelTrigger text before selection, and the menu heading.string
optionsThe selectable options. Each is { value, label, count? }.{ value: string; label: string; count?: number }[]
selectedValueThe value of the currently selected option.string
onSelectCalled with the chosen option’s value when the selection changes.(value: string) => void
classNameAdditional CSS classes applied to the trigger button.string