Segmented Control

Segmented control with a raised thumb that springs between options, arrow, Home and End key support, icons, badges, three sizes and reduced motion support.

src/registry/ui/segmented-control.tsx/r/segmented-control.json

Click or use arrow keys

Installation#

bash
npx shadcn@latest add @minidev/segmented-control

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/segmented-control.json

Usage#

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

export function Example() {
  return (
    <SegmentedControl disabled items={["Day", "Week", "Month"]} aria-label="Disabled range" />
  )
}

API reference#

SegmentedControl props
PropTypeDefault
optionsOption[]-
itemsstring[]-
valuestring-
defaultValuestring-
onChange(value: string) => void-
sizeSize"default"
fullWidthboolean-
disabledboolean-
classNamestring-
aria-labelstring-

Dependencies#

npm

motion

Built from

No other MiniDev files

Examples#

All form components

Learn more