# SegmentedControl

A compact selection rail for density, view and other immediate choices.

- Family: Forms, imported from `mizu-ui` or `mizu-ui/forms`
- Docs: https://mizu.user64bit.world/components/segmented-control
- Source: https://github.com/0xuser64bit/mizu/blob/main/packages/mizu/src/forms/Selection.tsx

## Usage

```tsx
"use client";

import { useState } from "react";
import { SegmentedControl } from "mizu-ui";

export function Example() {
  const [value, setValue] = useState("week");
  return (
    <SegmentedControl
      label="Period"
      value={value}
      onValueChange={setValue}
      options={[
        { value: "day", label: "Day" },
        { value: "week", label: "Week" },
        { value: "month", label: "Month" },
      ]}
    />
  );
}
```

## Copy it with the shadcn CLI

```sh
npx shadcn@latest init 0xuser64bit/mizu/preset # once, where there is no components.json
npx shadcn@latest add 0xuser64bit/mizu/segmented-control
```

## Props

- `options`: `Choice[]`. Visible choices and disabled states.
- `value / onValueChange`: `string / function`. Controlled selected segment.

## Accessibility

Native radios supply keyboard navigation. It selects a value; use Tabs for associated content panels.

## Motion

CSS transitions explain state changes. Reduced motion removes travel.
