Segmented Control

An iOS-style switcher with a sliding thumb. A real radio group.

no dependenciesMIT · free

$12/mo

Installation

npx shadcn@latest add https://ombakui.com/r/segmented-control.json

Usage

import { SegmentedControl } from "@/components/segmented-control";

<SegmentedControl label="Billing period" options={["Monthly", "Yearly"]} value={period} onChange={setPeriod} />

Props

PropTypeDefaultDescription
options*string[]–The options.
valuestring–Selected option (controlled).
defaultValuestring–Selected option when uncontrolled. Defaults to the first option
onChange(value: string) => void–Called with the newly selected option.
label*string–Accessible name for the group.
classNamestring–