# Segmented Control — React Native component for Expo

> A liquid indicator that stretches as it slides; drag it to scrub.

A liquid indicator: the leading edge springs ahead and the trailing edge catches up, so it stretches between segments — measured with onLayout to fit any label. Drag the selected segment to scrub. iOS pill, tab underline and outline looks, with icons and three sizes.

- Docs: https://expokit.in/docs/components/segmented-control
- Tier: Free
- Also called: segmented button, toggle group, iOS segmented picker
- Category: Selection
- Platforms: iOS, Android, web
- Expo Go: yes, no development build needed
- npm dependencies: react-native-svg, expo-haptics
- Uses ExpoKit items: kit
- Variants: Pill, Underline, Outline, With Icons, Accent, Sizes

## Installation

Run once per project: `npx @expokit/cli@latest init` (shared theme + KitProvider). Then:

```bash
npx @expokit/cli@latest add segmented-control
```

The CLI copies the source into your project (you own the code) and installs react-native-svg, expo-haptics.

Import: `import { SegmentedControl } from "@/components/ui/segmented-control";`

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `options` | `(string \| { value, label?, icon?, disabled? })[]` | — | Segments. `icon` can be a node or ({ active, color }) => node. |
| `value / onValueChange` | `string` | — | Controlled selection (or use defaultValue; defaults to the first segment). |
| `defaultValue` | `string` | `first segment` | Initial selection when uncontrolled. |
| `variant` | `"pill" \| "underline" \| "outline"` | `"pill"` | Raised pill on a track, tab underline, or tinted outline. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | 32 / 40 / 48pt tall. |
| `fullWidth` | `boolean` | `true` | Equal-width segments filling the row, or segments sized to their labels. |
| `accent` | `string` | `theme accent` | Indicator colour (pill becomes a filled accent pill). |
| `haptics` | `boolean` | `true` | Selection tick on change. |
| `disabled` | `boolean` | `false` | Dims and blocks presses. |
| `style` | `StyleProp<ViewStyle>` | — | Style for the track holding the segments. |
| `className` | `string` | — | Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. |

## Behaviour & accessibility

- **Motion**: The leading edge of the indicator springs ahead and the trailing edge catches up, so it stretches as it travels. Labels squish on press and bounce when selected.
- **Touch**: A sideways drag that starts on the selected segment scrubs across the others; drags that start elsewhere are left to a parent ScrollView. Short segments get hitSlop up to 44pt.
- **Haptics**: A selection tick plays on each change (haptics, on by default).
- **Screen readers**: A tablist of tabs with selected and disabled state, labelled by each option's label or accessibilityLabel.

## FAQ

### How do I make a segmented button in React Native?

Use ExpoKit's Segmented Control: run npx @expokit/cli@latest add segmented-control in your Expo or React Native project and it copies a ready-made segmented button into your app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.

### Does Segmented Control work in Expo Go?

Yes. Segmented Control runs in Expo Go on iOS and Android with no development build — its packages (react-native-svg, expo-haptics) are all included in Expo Go.

### How do I add Segmented Control to my Expo app?

Run npx @expokit/cli@latest add segmented-control in your project. The CLI copies the component's source into your app and installs react-native-svg, expo-haptics, so the code is yours to change.

### Is Segmented Control free?

Yes. Segmented Control is free: its full source is on this page and the CLI installs it without an account.

### Can I change how Segmented Control looks?

Yes. It takes its colours, radius and light / dark mode from useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.

## More

- Live preview, variants and code: https://expokit.in/docs/components/segmented-control
- Every ExpoKit component, screen, template and chart: https://expokit.in/llms.txt
- Install commands and props for every free component: https://expokit.in/llms-full.txt
- Pricing: https://expokit.in/pricing
