Materialish

Switch

A Switch represents a value that can be toggled on or off.

🙌 Heads up! This code is editable. The preview above will update to reflect your changes.

Usage

import { Switch } from 'materialish';
import 'materialish/materialish.css';

Props

Prop NameDefault ValueDescription
classNameAdditional class name(s) to add to the Switch
styleInline styles to add to the root element of the Switch
nodeRefPass a ref to get access to the input node
...restOther props are placed on the underlying input element

CSS Variables

VariableDefault ValueDescription
--mt-baseFontSize1remThe size of the switch is based off of this value
--mt-switch-backgroundColor#979696The color of the switch's bar
--mt-switch-backgroundColorActive#b0cfe9The color of the switch's bar when it is active
--mt-switch-backgroundColorDisabled#d9d9d9The color of the switch's bar when it is disabled
--mt-switch-knobColor#fafafaThe color of the switch's knob
--mt-switch-knobColorActive--mt-mainColor, #2196f3The color of the switch's knob when it is active
--mt-switch-knobColorDisabled#979696The color of the switch's knob when it is disabled
--mt-switch-focusColor#979696The color of the focused circle layer
--mt-switch-focusColorActive--mt-mainColor, #2196f3The color of the focused circle layer when it is active

Useful Links