Getting Started
Foundations
Components
Search for a command to run...
Toggles provide a button-like control that maintains a pressed or unpressed state, making them ideal for toolbar controls, formatting options, or any interface element that represents a binary state that persists across interactions. Unlike switches which typically represent settings that take immediate effect, toggles are often used for mode selection or formatting choices where multiple toggles can be active simultaneously. They provide clear visual feedback about their current state through styling changes.
Use toggles in toolbars, text editors, or control panels where users need to select options that can be independently turned on or off. They work particularly well when grouped together for related controls like text formatting (bold, italic, underline). Toggles should have clear icons or labels that indicate what feature they control, and their pressed state should be visually distinct from their unpressed state.
import { Toggle } from "@strongtie/design-system/toggle"<Toggle>| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | null | - | |
variant | "default" | "outline" | null | - |
Components can be styled using the className prop. The design system uses Tailwind CSS for styling.
CSS classes used by this component:
toggleEnsure proper accessibility attributes are added when implementing this component.