# Toggle ## Examples ### Default ```html ``` ### States ```html ``` ### WithError ```html Error message Error message ``` ### WithHint ```html ``` ### WithErrorAndHint ```html ``` ### LongLabel ```html ``` ### LongTexts ```html ``` ## Usage **Use the Toggle to:** - Enable or disable a setting with an immediate effect. - Represent a binary choice (e.g., on/off, show/hide, enable/disable). - Improve clarity when changes apply instantly without additional confirmation. - Make a setting’s status clearly visible at a glance. **Do not use the Toggle to:** - Submit forms or trigger complex actions (use buttons instead). - Choose between more than two options (use radio buttons or dropdowns instead). - Require explicit confirmation before applying changes (use checkboxes or modals). - Replace checkboxes for settings that require additional information or context. ## Other Considerations - **Labeling:** Ensure toggles have clear, descriptive labels. Labels should explain what the toggle controls (e.g., "Enable Dark Mode"). - **Default State:** Default states should be based on user expectations. If a feature is optional, it should be off by default. - **Grouping:** If multiple toggles are related, visually group them together to maintain clarity. ## Design Rationale - **Immediate Feedback:** Unlike checkboxes, toggles indicate that changes take effect immediately, making them ideal for system or UI settings. - **Recognition Over Recall:** A toggle’s visual representation (switching between states) helps users understand its purpose at a glance. - **Consistency:** Standardizing toggles across the application ensures a familiar and predictable user experience.