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/toggle

Examples

Default

"use client"

import { useState } from "react"

Props

Extends all Radix Toggle.Root props.

PropTypeDefaultDescription
pressedboolean—Controlled pressed state
onPressedChange(pressed: boolean) => void—Called when pressed state changes
defaultPressedboolean—Uncontrolled initial state
disabledboolean—Disables the toggle