Installation

Add ReactFormSwitch and its peers to a React app.

GitHub

ReactFormSwitch has peer dependencies on React, React Hook Form, and Zod — install them alongside the package:

npm i reactformswitch react-hook-form zod

Peer version ranges: react / react-dom ≥ 18, react-hook-form ≥ 7, zod ≥ 3.

Import

Import the component and the stylesheet once (e.g. in your app root):

import { FormSwitch } from 'reactformswitch'
import 'reactformswitch/styles.css'

The stylesheet ships the default theme as --fs-* CSS variables. You can override those variables, pass a theme, or configure everything from JSON via ui — see Theming.

The package is ESM + CJS with bundled .d.ts types. Nothing else is required — no provider, no context wrapper. Continue to the Quick start.

On this page