Home/Components/Toggle Switch
Back to components

Toggle Switch

Elegant toggle switches with smooth animations and state indicators.

Forms
Toggle Switch

React

import { Toggle } from '@/components/ui/toggle'
import { useState } from 'react'

export default function App() {
  const [checked, setChecked] = useState(false)
  
  return (
    <Toggle checked={checked} onCheckedChange={setChecked}>
      Airplane Mode
    </Toggle>
  )
}

Next.js

'use client'

import { Toggle } from '@/components/ui/toggle'
import { useState } from 'react'

export default function SettingsPage() {
  const [checked, setChecked] = useState(false)
  
  return (
    <Toggle checked={checked} onCheckedChange={setChecked}>
      Airplane Mode
    </Toggle>
  )
}

Variants

Default
Default
With Label
With Label
Disabled
Disabled

Related Components