Sign up and get 15% off every plan.

Sign up
Menu
Sliders and switchesHeroUIApache-2.0 licenceFree

Switch

An on and off switch.

Add it to your project

Or install the packages yourselfTerminal
npm install @heroui/react

The code

components/switch-demo.tsxReact
/**
 * Demo from HeroUI, https://heroui.com (docs example switch/basic.tsx).
 * Apache-2.0, Copyright 2025 NextUI Inc. Full text: https://github.com/heroui-inc/heroui/blob/main/LICENSE
 * Changed for Tastebud: a default export (HeroUI's docs use named ones) without the docs site's prop
 * controls.
 */
import {Switch} from "@heroui/react";

export default function SwitchDemo() {
  return (
    <Switch>
      <Switch.Content>
        <Switch.Control>
          <Switch.Thumb />
        </Switch.Control>
        Enable notifications
      </Switch.Content>
    </Switch>
  );
}

Changed for this site: A default export (HeroUI's docs use named ones) without the docs site's prop controls.