0

Toggle

A two-state button that can be either on or off.

import { IconBookmark } from "@tabler/icons-react"

import { Toggle } from "@/components/ui/toggle"

Installation

bunx --bun shadcn@latest add @ondo-ui/toggle

Usage

import { Toggle } from "@/components/ui/toggle"
<Toggle>Toggle</Toggle>

Examples

Outline

Use variant="outline" for an outline style.

import { IconBold, IconItalic } from "@tabler/icons-react"

import { Toggle } from "@/components/ui/toggle"

With Text

import { IconItalic } from "@tabler/icons-react"

import { Toggle } from "@/components/ui/toggle"

Size

Use the size prop to change the size of the toggle.

import { Toggle } from "@/components/ui/toggle"

export function ToggleSize() {

Disabled

import { Toggle } from "@/components/ui/toggle"

export function ToggleDisabled() {

API reference

The component wraps Base UI Toggle and accepts all of its props.