Rad UI is under active development and looking for contributors to shape the future of the library. If you'd like to contribute to Rad UI, please check out Getting Started

Toggles are used to switch between two states. They are commonly used in settings, forms, and more.


import Toggle from "@radui/ui/Toggle";

const ToggleExample = () => {
  const [pressed, setPressed] = React.useState(false)

  const handleChange = (newPressed) => {
    setPressed(newPressed)
  }
  
  return (
    <Toggle pressed={pressed} onChange={handleChange}>
      <Icon />
    </Toggle>
  )
}