Component libraryToggle button
Components/Essentials

Toggle button

Free

Turn one immediate view or mode on and off with a native pressed button.

npx shadcn@latest add https://tidalui.com/r/toggle-button.json
Desktop viewport

Installation

Terminal
npx shadcn@latest add https://tidalui.com/r/toggle-button.json

Import components/ui/tidal.css, components/ui/toggle-button.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.

Usage

Complete example source · Dependency and asset manifest

Loading the complete example…

API & behavior

Required ReactNode label supplies the default accessible name, remains available in iconOnly mode, and may be overridden by a native aria-label. Optional decorative icon, iconOnly, controlled pressed or uncontrolled defaultPressed, onPressedChange(nextPressed,event), and readOnly. Remaining compatible native button attributes, form ownership, name/value, submitter overrides, className, explicit aria-disabled=false and forwarded ref are preserved; type defaults to button but can be overridden. When available, native onClick runs first and preventDefault suppresses the state proposal; readOnly and disabled states suppress it. Native disabled and aria-disabled true resolve to disabled behavior; readOnly stays focusable, exposes aria-disabled and suppresses changes. Consumers own controlled acceptance, application behavior, persistence and form results.

Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.

Building with an agent?Give it the installation guide and component catalog.