byDefaultHuman
Components

Toggle

A hand-drawn toggle switch with a sliding circle thumb.

Installation

package manager
npx shadcn add https://bydefaulthuman.fun/r/toggle.json

Props

PropTypeDefaultDescription
checked
boolean
Controls the `checked` behavior.
className
string
Additional Tailwind classes applied to the component.
defaultChecked
boolean
false
Controls the `defaultChecked` behavior.
disabled
boolean
false
Disables interaction.
id
string
Optional stable id used for sketch seeding and accessibility.
label
string
Optional label text shown with the component.
onChange
(checked: boolean) => void
Callback fired when the value changes.
theme
CrumbleTheme
Overrides the global Crumble theme for this instance.
variant
ToggleVariant
"ball"
Controls the `variant` behavior.

States

Without label

Accessibility

Toggle uses a native checkbox input and mirrors its state visually with the rough sketch track. Pair it with a clear text label so assistive technologies can announce the setting meaningfully.

Examples

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

<Toggle label="Notifications" />;