# react-three-toggle

> Multi-value toggle component for React. Click to cycle through three or more options with optional wrap and form integration.

Latest version **1.1.1** (published 2026-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-three-toggle
pnpm add react-three-toggle
yarn add react-three-toggle
bun add react-three-toggle
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2026-08-19 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | piro0919 <piro.haniwa@gmail.com> (https://kkweb.io/) |
| Maintainers | piro0919 |
| Keywords | react, toggle, multi-toggle, switch, cycle, headless |

## Links

- npm: https://www.npmjs.com/package/react-three-toggle
- Repository: https://github.com/piro0919/react-three-toggle
- Homepage: https://react-three-toggle.kkweb.io
- Issues: https://github.com/piro0919/react-three-toggle/issues
- Funding: https://github.com/sponsors/piro0919
- npm.io page: https://npm.io/package/react-three-toggle

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2026-08-19
- 1.1.0 — 2026-05-16
- 1.0.0 — 2026-05-16
- 0.5.2 — 2021-07-25
- 0.5.1 — 2021-07-25
- 0.5.0 — 2021-07-22
- 0.4.0 — 2021-03-29
- 0.3.0 — 2021-03-26
- 0.2.0 — 2021-03-20
- 0.1.4 — 2021-03-19
- 0.1.3 — 2021-03-19
- 0.1.2 — 2021-03-19
- 0.1.1 — 2021-03-19
- 0.1.0 — 2021-03-19

## README

# react-three-toggle

> Multi-value toggle component for React. Cycle through three or more options on click.

[![npm](https://img.shields.io/npm/v/react-three-toggle.svg)](https://www.npmjs.com/package/react-three-toggle)
[![license](https://img.shields.io/npm/l/react-three-toggle.svg)](./LICENSE)

A small, dependency-free toggle that cycles through 3+ options with a sliding indicator. Click or use arrow keys. Supports controlled / uncontrolled modes, wrap-around, horizontal / vertical orientation, and form integration via a hidden input.

🌐 **Demo:** <https://react-three-toggle.kkweb.io>

## Install

```bash
npm install react-three-toggle
```

Requires React 18 or 19.

## Usage

```tsx
import { ThreeToggle } from "react-three-toggle";

export function App() {
  return (
    <ThreeToggle
      values={["light", "auto", "dark"]}
      defaultValue="auto"
      onValueChange={(v) => console.log(v)}
    />
  );
}
```

Rich labels:

```tsx
<ThreeToggle
  values={[
    { label: "🌞 Light", value: "light" },
    { label: "🤖 Auto", value: "auto" },
    { label: "🌙 Dark", value: "dark" },
  ]}
/>
```

## API

| Prop                 | Type                              | Default        | Description                                                   |
| -------------------- | --------------------------------- | -------------- | ------------------------------------------------------------- |
| `values`             | `string[] \| { label?, value }[]` | —              | Options. At least one required.                               |
| `defaultValue`       | `string`                          | first option   | Initial value (uncontrolled).                                 |
| `value`              | `string`                          | —              | Controlled value.                                             |
| `onValueChange`      | `(value: string) => void`         | —              | Fired on selection change.                                    |
| `wrap`               | `boolean`                         | `true`         | Wrap from last back to first; set `false` to stop at the end. |
| `orientation`        | `"horizontal" \| "vertical"`      | `"horizontal"` | Layout direction.                                             |
| `name`               | `string`                          | —              | Renders a hidden input for form submission.                   |
| `disabled`           | `boolean`                         | `false`        | Disable interaction.                                          |
| `className`          | `string`                          | —              | Root class.                                                   |
| `indicatorClassName` | `string`                          | —              | Indicator class.                                              |
| `optionClassName`    | `string`                          | —              | Option class.                                                 |

Each option exposes `data-selected="true"` when active. Root exposes `data-three-toggle`, `data-orientation`, `data-disabled`.

## License

MIT

---
_Source: https://npm.io/package/react-three-toggle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
