Black Friday · Save 40% on Intent UI Design licenses with code UI2026.

Toggle

Loading...

Installation

Add the component with the CLI.

npx shadcn@latest add @intentui/toggle

Manual installation

Install the dependencies, then copy the component source into your project.

npm install react-aria-components tailwind-variants cn

Touch target

Add the following utility to your global CSS file to ensure interactive elements have a minimum touch target of 44 × 44 pixels without changing their visual size.

@utility touch-target {
  position: relative;
  &::before {
    content: "";
    position: absolute;
    display: block;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    min-height: 44px;
    min-width: 44px;
    z-index: 9999;
  }
}

This utility is automatically included when installing the Toggle component via the CLI. You only need to add it for manual installations.

Examples

Intent

Customize the look of the toggle button using the intent prop.

Loading...

Size

Adjust the toggle button's size using the size prop.

Loading...

Controlled

Manage the toggle button's state with the isSelected prop.

Loading...

Disabled

Set isDisabled to disable the toggle button.

Loading...

Component API

Toggle

Toggle extends the React Aria Components <ToggleButton> component.

classNamestring
intent"outline" | "plain"
Default: plain
isCircleboolean
Default: false
size"xs" | "sm" | "md" | "lg" | "sq-xs" | "sq-sm" | "sq-md" | "sq-lg"
Default: md

See the React Aria for the full API reference.

Design