1 | .md-segmented-button { |
2 | display: flex; |
3 | align-items: stretch; |
4 | box-sizing: border-box; |
5 | border: 0.0625rem solid var(--md-sys-color-outline); |
6 | height: 2.5rem; |
7 | border-radius: 1.25rem; |
8 | overflow: hidden; |
9 | } |
10 | |
11 | .md-segmented-button[hidden] { |
12 | display: none; |
13 | } |
14 | |
15 | .md-segmented-button input { |
16 | -webkit-appearance: none; |
17 | appearance: none; |
18 | flex: 0 1 0.0625rem; |
19 | width: 0.0625rem; |
20 | height: 2.375rem; |
21 | margin: 0; |
22 | padding: 0; |
23 | background-color: var(--md-sys-color-outline); |
24 | } |
25 | |
26 | .md-segmented-button input:first-of-type { |
27 | transform: scaleX(0); |
28 | } |
29 | |
30 | .md-segmented-button input:focus { |
31 | outline: none; |
32 | } |
33 | |
34 | .md-segmented-button :checked+label { |
35 | color: var(--md-sys-color-on-secondary-container); |
36 | } |
37 | |
38 | .md-segmented-button label { |
39 | position: relative; |
40 | flex: 1 1 1.5rem; |
41 | display: block; |
42 | box-sizing: border-box; |
43 | height: 2.375rem; |
44 | line-height: 2.375rem; |
45 | text-align: center; |
46 | color: var(--md-sys-color-on-surface); |
47 | font-family: var(--md-sys-typescale-label-large-font); |
48 | font-weight: var(--md-sys-typescale-label-large-weight); |
49 | font-size: var(--md-sys-typescale-label-large-size); |
50 | font-style: var(--md-sys-typescale-label-large-font-style); |
51 | letter-spacing: var(--md-sys-typescale-label-large-tracking); |
52 | text-transform: var(--md-sys-typescale-label-large-text-transform); |
53 | text-decoration: var(--md-sys-typescale-label-large-text-decoration); |
54 | padding: 0 0.75rem; |
55 | overflow: hidden; |
56 | white-space: nowrap; |
57 | text-overflow: ellipsis; |
58 | overflow: hidden; |
59 | } |
60 | |
61 | .md-segmented-button label::before { |
62 | |
63 | content: ""; |
64 | position: absolute; |
65 | z-index: -2; |
66 | top: 0; |
67 | right: 0; |
68 | left: 0; |
69 | bottom: 0; |
70 | } |
71 | |
72 | .md-segmented-button label::after { |
73 | |
74 | content: ""; |
75 | position: absolute; |
76 | z-index: -1; |
77 | top: 0; |
78 | right: 0; |
79 | left: 0; |
80 | bottom: 0; |
81 | background-color: transparent; |
82 | } |
83 | |
84 | .md-segmented-button :checked+label::before { |
85 | |
86 | background-color: var(--md-sys-color-secondary-container); |
87 | } |
88 | |
89 | .md-segmented-button label span { |
90 | vertical-align: middle; |
91 | color: var(--md-sys-color-on-surface); |
92 | font-size: 1.125rem; |
93 | width: 1.125rem; |
94 | height: 1.125rem; |
95 | margin-right: 0.5rem; |
96 | } |
97 | |
98 | |
99 | .md-segmented-button label span:first-child { |
100 | display: none; |
101 | } |
102 | |
103 | .md-segmented-button :checked+label span:first-child { |
104 | display: inline-block; |
105 | color: var(--md-sys-color-on-secondary-container); |
106 | } |
107 | |
108 | |
109 | .md-segmented-button label:hover::after { |
110 | background-color: var(--md-sys-color-on-surface); |
111 | opacity: var(--md-sys-state-hover-state-layer-opacity); |
112 | } |
113 | |
114 | |
115 | .md-segmented-button :checked+label:hover::after { |
116 | background-color: var(--md-sys-color-on-secondary-container); |
117 | } |
118 | |
119 | |
120 | .md-segmented-button :focus+label::after { |
121 | background-color: var(--md-sys-color-on-surface); |
122 | opacity: var(--md-sys-state-focus-state-layer-opacity); |
123 | } |
124 | |
125 | |
126 | .md-segmented-button :focus:checked+label::after { |
127 | background-color: var(--md-sys-color-on-secondary-container); |
128 | } |
129 | |
130 | .md-segmented-button label:active, |
131 | .md-segmented-button :active+label { |
132 | background-position: center; |
133 | background-image: |
134 | radial-gradient(circle, var(--md-riple-color) 1%, transparent 1%); |
135 | background-size: 100%; |
136 | animation-name: md-ripple; |
137 | animation-duration: var(--md-sys-motion-duration-500); |
138 | } |
139 | |
140 | |
141 | .md-segmented-button :active+label::after { |
142 | background-color: var(--md-sys-color-on-surface); |
143 | opacity: var(--md-sys-state-pressed-state-layer-opacity); |
144 | } |
145 | |
146 | |
147 | .md-segmented-button :active:checked+label::after { |
148 | background-color: var(--md-sys-color-on-secondary-container); |
149 | } |