# Switches A `Switch` represents a button with two states, on and off. Switches are most often used on mobile devices to enable and disable options in an options menu. A switch consists of a track and thumb; the thumb moves along the track to indicate its current state. ## Design & API Documentation - [Material Design guidelines: Switches](https://material.io/go/design-switches) - [Class definition](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/switchmaterial/SwitchMaterial.java) - [Class overview](https://developer.android.com/reference/android/support/v7/widget/SwitchCompat) ## Usage The `SwitchMaterial` widget provides a complete implementation of Material Design's switch component. It extends from the support library's `SwitchCompat` widget, but not from the framework Switch widget. As such, it does not auto-inflate, unlike other selection controls, and must be explicitly specified in layouts. ```xml ``` ### Material Styles Using a Material Components theme with `SwitchMaterial` will match the color of `SwitchMaterial` views to your theme's palette. If you want to override this behavior, as you might with custom drawables, set the `useMaterialThemeColors` parameter to false. ```xml ``` ### Styles Use `switchStyle` for style changes. ```xml @style/Widget.MaterialComponents.CompoundButton.Switch ```