2 * Copyright 2015 Google Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 @import "../variables";
26 vertical-align: middle;
28 display: inline-block;
30 box-sizing: border-box;
32 height: $switch-label-height;
39 padding-left: $switch-track-length - 8px;
42 // avoids blue box around switch
43 -webkit-touch-callout: none;
44 -webkit-user-select: none;
45 -moz-user-select: none;
46 -ms-user-select: none;
51 line-height: $switch-label-height;
53 .mdl-switch.is-upgraded & {
54 // Hide input element, while still making it respond to focus.
62 -moz-appearance: none;
63 -webkit-appearance: none;
70 background: $switch-off-track-color;
73 top: $switch-track-top;
74 height: $switch-track-height;
75 width: $switch-track-length;
76 border-radius: $switch-track-height;
80 .mdl-switch.is-checked & {
81 background: $switch-track-color;
84 fieldset[disabled] .mdl-switch,
85 .mdl-switch.is-disabled & {
86 background: $switch-disabled-track-color;
92 background: $switch-off-thumb-color;
95 top: $switch-thumb-top;
96 height: $switch-thumb-size;
97 width: $switch-thumb-size;
102 @include shadow-2dp();
104 @include material-animation-default(0.28s);
105 transition-property: left;
107 .mdl-switch.is-checked & {
108 background: $switch-thumb-color;
109 left: $switch-track-length - $switch-thumb-size;
111 @include shadow-3dp();
114 fieldset[disabled] .mdl-switch,
115 .mdl-switch.is-disabled & {
116 background: $switch-disabled-thumb-color;
121 .mdl-switch__focus-helper {
126 transform: translate(-$switch-helper-size / 2, -$switch-helper-size / 2);
128 display: inline-block;
130 box-sizing: border-box;
131 width: $switch-helper-size;
132 height: $switch-helper-size;
135 background-color: transparent;
137 .mdl-switch.is-focused & {
138 box-shadow: 0 0 0px (($switch-ripple-size - $switch-helper-size) / 2)
140 background-color: rgba(0, 0, 0, 0.1);
143 .mdl-switch.is-focused.is-checked & {
144 box-shadow: 0 0 0px (($switch-ripple-size - $switch-helper-size) / 2)
146 background-color: $switch-faded-color;
153 font-size: $switch-label-font-size;
154 line-height: $switch-label-height;
158 fieldset[disabled] .mdl-switch,
159 .mdl-switch.is-disabled & {
160 color: $switch-disabled-thumb-color;
165 .mdl-switch__ripple-container {
168 top: -($switch-ripple-size - $switch-label-height) / 2;
169 left: $switch-thumb-size / 2 - $switch-ripple-size / 2;
171 box-sizing: border-box;
172 width: $switch-ripple-size;
173 height: $switch-ripple-size;
179 -webkit-mask-image: -webkit-radial-gradient(circle, white, black);
181 transition-duration: 0.40s;
182 transition-timing-function: step-end;
183 transition-property: left;
186 background: $switch-color;
189 fieldset[disabled] .mdl-switch,
190 .mdl-switch.is-disabled & {
194 fieldset[disabled] .mdl-switch & .mdl-ripple,
195 .mdl-switch.is-disabled & .mdl-ripple {
196 background: transparent;
199 .mdl-switch.is-checked & {
200 left: $switch-track-length - $switch-ripple-size / 2 -
201 $switch-thumb-size / 2;