GodUI

Segmented Control

An iOS-style selector with a sliding pill that springs between options.

Sizes

Installation

pnpm dlx shadcn@latest add "https://godui.design/r/segmented-control.json"

Usage

tsx
 
import { SegmentedControl } from "@godui/components";

const [view, setView] = useState("week");

<SegmentedControl
  options={[
    { label: "Day", value: "day" },
    { label: "Week", value: "week" },
  ]}
  value={view}
  onChange={setView}
/>;

Props

PropTypeDefaultDescription
optionsSegmentedOption[]{ label, value, icon?, disabled? }.
valuestringControlled value.
defaultValuestringfirst optionUncontrolled value.
size"sm" | "md" | "lg""md"Control size.
onChange(value: string) => voidFires on selection.

On this page

Built with GodUI

Beautifully crafted motion components for modern interfaces.

Star on GitHub