edbnedbn/ui
ComponentsMapsAudioPDF
GitHub stars
Explorer
Get Started
Components

Toggle

Pressable toggle button with on/off state.

Componentsdocsbase-ui/toggle

Installation

npx shadcn@latest add https://ui.edbn.me/r/toggle.json

Manual

API Reference

Root

A toggle button that can be on or off. Renders a button element.

defaultPressedboolean
=false

Initial pressed state

pressedboolean

Controlled pressed state

onPressedChangefunction

Called when state changes

disabledboolean
=false

Disable toggle

nativeButtonboolean
=true

Render as native button

classNamestring | function

CSS class name

renderReactElement | function

Custom render function

Root data attributes
AttributeDescription
data-pressedPresent when toggle is on
data-disabledPresent when toggle is disabled