Voit Docs
  • Read Me
  • Introduction
    • Get Started
  • Design Language
    • Philosophy
  • Accessing The Design System
    • Using Variables
  • Structure Overview
  • Accessibility & Inclusivity
  • Guidelines
    • Design tokens
  • Components
    • Overview
    • Accordion
    • Aspect Ratio
    • Badge
    • Breadcrumb
    • Button
    • Tab Button
    • Tile Button
    • Card (Header, Footer)
    • Checkbox
    • ComboBox
    • Digit Entry
    • Dimming Overlay
    • File Drop
    • Index Bar
    • Info Label
    • Inline Message
    • Link
    • List Item
    • List Tree
    • Page Control
    • Pagination
    • Popover
    • Progress Bar
    • Progress Indicator
    • Radio
    • Segmented Control
    • Select
    • Shortcut
    • Slider
    • Stepper
    • Switch
    • Tag
    • Text Area
    • Text field
    • Toast
    • Tooltip
    • Tool Bar
  • Legal
    • Terms & Conditions
    • Contact US
    • License Agreement
    • Feedback
Powered by GitBook
On this page
  • Overview
  • When to use
  • When not to use
  • Types
  • Anatomy
  • States
  • Size
  • Accessibility
  • Example
  1. Components

Switch

Switches allow users to toggle between two states, such as on and off. They are typically accompanied by labels and can display additional support messages to provide context or instructions.

PreviousStepperNextTag

Last updated 7 months ago

Overview

Switches provide a direct way to change settings, offering immediate feedback to users when they toggle between states like active/inactive or enabled/disabled.

When to use

  • Ideal for settings that take effect immediately after toggling, without needing to click additional buttons.

  • Use switches to control device settings, such as Wi-Fi, Bluetooth, or dark mode, where a clear on/off distinction is necessary.

  • When users need to customize their preferences, switches provide an easy and familiar interaction for toggling options.

  • Switches are helpful when you want to simplify user decisions by offering clear, binary choices.

When not to use

  • Avoid using switches when there are more than two choices available. Consider a dropdown or radio buttons instead.

  • Don’t use switches for actions that require a confirmation, such as submitting a form or deleting content.

  • Avoid using switches if no immediate change is needed after toggling, such as scheduling changes that take effect later.

  • Do not use switches if toggling a setting could result in ambiguous behavior or unintended consequences without proper user understanding.

Types

Anatomy

  1. Toggle Base: The main component that visually represents the toggle’s inactive and active state.

  2. Icon Leading: An optional icon or indicator at the start of the switch.

  3. Text (Label): The label next to the switch that explains what the switch controls.

  4. Icon Trailing: An optional icon or indicator on the right side of the switch.

  5. Inline Message: Additional text that explains or clarifies the action the switch is controlling. It can include instructions, descriptions, or warnings to provide further context.

States

Size

Size
Text (px)
Icon (px)
Support (px)
Container Height (px)

Small

14

16

12

38

Medium

16

20

12

40

Accessibility

  • Keyboard Accessibility: Ensure switches can be toggled via keyboard (spacebar or enter key) to accommodate users who cannot use a mouse or touchscreen.

  • Clear Focus Indicator: Provide a visible focus state for keyboard navigation so users know which element is currently selected.

  • Screen Reader Compatibility: Label the switch states (e.g., "on" and "off") for screen readers to clearly communicate the current state to visually impaired users.

  • Avoid Color-Only State Indication: Do not rely solely on color to differentiate the switch state. Use icons, text labels, or support messages to indicate state changes.

  • Consistent Interaction: Ensure that the switch behavior is consistent across devices, especially in touch, mouse, and keyboard interactions.

Example

  • Device Settings: Commonly used to toggle Wi-Fi, Bluetooth, and other system settings in mobile apps and devices.

  • Account Preferences: Used for turning on/off email notifications, privacy settings, or two-factor authentication options.

  • Dark Mode Switch: A typical example is allowing users to toggle between light and dark mode in user interfaces.

  • Feature Activation: Toggles to enable or disable specific features or tools within a platform, such as location services or app permissions.

  • Power Control: Used to turn devices, appliances, or virtual features (e.g., voice assistant) on or off, ensuring intuitive control over power.