eBay MIND Patterns
  • Introduction
  • Messaging
    • Alert Dialog
    • Confirm Dialog
    • File Preview Card
    • Form Validation
    • Inline Notice
    • Input Meter
    • Input Validation
    • Page Notice
    • Star Rating (static)
    • Time
    • Toast Dialog
    • Tourtip
  • Input
    • Button
    • Checkbox
    • Chips Combobox
    • Combobox
    • Date Picker
    • File Input
    • Input Dialog
    • Listbox
    • Listbox Button
    • Menu
    • Menu Button
    • Phone Input
    • Radio
    • Select
    • Star Rating (interactive)
    • Switch
    • Toggle Button
    • Toggle Button Group
  • Navigation
    • Breadcrumbs
    • Fake Menu Button
    • Fake Tabs
    • Link
    • Pagination
    • Skip Navigation
    • Tile
  • Disclosure
    • Accordion
    • Carousel
    • Lightbox Dialog
    • Details
    • Flyout
    • Footnote
    • Infotip Button
    • Panel Dialog
    • Pulldown List
    • Segmented Buttons
    • Tabs
    • Tooltip
  • Structure
    • Description List
    • Form
    • Heading
    • Image
    • Item Tile
    • Layout Grid
    • Region
    • Table
    • Table Cell
  • Techniques
    • Active Descendant
    • Ambiguous Label
    • Background Icon
    • Keyboard Trap
    • Live Region
    • Offscreen Text
    • Roving Tabindex
    • Skip to Main Content
    • Alternative Text
  • Anti-Patterns
    • Disabling Pinch-to-Zoom
    • Hand Cursor on Buttons
    • JavaScript HREF
    • Layout Table
    • Mouse Hover on Static Elements
    • Open New Window
    • Setting Focus on Page Load
    • Tabindex-itis
    • Title Tooltip
  • Appendix
    • ARIA Essentials
    • Checklist
    • FAQ
    • Keyboard Interface
    • Known Issues
    • Legacy Patterns
      • Fullscreen Dialog
    • MIND Pattern Template
    • Pattern Naming Scheme
    • References
    • Utilities
Powered by GitBook
On this page
  • Introduction
  • Best Practices
  • Working Examples
  • Interaction Design
  • Developer Guide
  • ARIA Reference
  1. Input

Switch

Represents whether a function is activated or not (i.e. on or off).

PreviousStar Rating (interactive)NextToggle Button

Last updated 3 months ago

Introduction

A switch typically executes JavaScript on the client when toggled rather than storing form data to be sent to the server. If you require the switch to store data inside of a form, you may wish to consider using an actual checkbox instead.

Best Practices

Individual switch must have a visible, onscreen label.

Groups of related switch controls must have a group label.

Working Examples

Interaction Design

This section provides interaction design for keyboard, screen reader and pointing devices.

Keyboard

Switch must be keyboard focusable (unless disabled).

If switch has keyboard focus, pressing SPACEBAR must toggle the checked state.

If switch has keyboard focus, pressing ENTER key toggle the checked state (optional).

If switch has keyboard focus, pressing TAB key or SHIFT-TAB key combo moves keyboard focus to next or previous interactive element on page respectively.

Screen Reader

Switch must be reachable with screen reader (even when disabled).

Switch must be announced as "switch".

Switch label must be announced.

Switch group label, if applicable, must be announced.

Switch state must be announced.

Pointer

Clicking switch must toggle the checked state.

Clicking switch label must toggle the checked state.

Developer Guide

This section is not yet available.

ARIA Reference

This section gives an overview of our use of ARIA, within the specific context of the switch pattern.

role=switch

Informs AT that this control has switch behavior.

aria-checked

Informs AT the current "checked" state of the switch.

Experience the pattern in action on our .

Examine the required markup structure in the .

View a fully styled example on our .

eBay MIND patterns examples website
GitHub bones project
eBay Skin website
Refinement Switch