Toggle
Pressable boolean toggle button built on Radix Toggle. Use for snap, grid, rulers, and other on/off states.
Install
npx shadcn@latest add https://substrate.georgedrury.co.uk/r/toggleExamples
Default
"use client"
import { useState } from "react"Props
Extends all Radix Toggle.Root props.
| Prop | Type | Default | Description |
|---|---|---|---|
pressed | boolean | — | Controlled pressed state |
onPressedChange | (pressed: boolean) => void | — | Called when pressed state changes |
defaultPressed | boolean | — | Uncontrolled initial state |
disabled | boolean | — | Disables the toggle |