G. css / md-filled-text-field.css

1
.md-filled-text-field {
2
 position: relative;
3
 overflow: hidden;
4
 display: flex;
5
 flex-direction: column;
6
 align-items: stretch;
7
 padding-top: calc(0.5rem + var(--md-sys-typescale-body-small-line-height));
8
 border-top-left-radius: var(--md-sys-shape-corner-extra-small-top-top-left);
9
 border-top-right-radius: var(--md-sys-shape-corner-extra-small-top-top-right);
10
 overflow: hidden;
11
}
12
13
/* container */
14
.md-filled-text-field::before {
15
 content: "";
16
 position: absolute;
17
 z-index: -2;
18
 top: 0;
19
 right: 0;
20
 left: 0;
21
 bottom: 0;
22
 background-color: var(--md-sys-color-surface-container-highest);
23
}
24
25
/* state layer */
26
.md-filled-text-field::after {
27
 content: "";
28
 position: absolute;
29
 z-index: -1;
30
 top: 0;
31
 right: 0;
32
 left: 0;
33
 bottom: 0;
34
 background-color: transparent;
35
}
36
37
.md-filled-text-field span,
38
.md-filled-text-field label {
39
 position: absolute;
40
 top: 0.5rem;
41
 left: 1rem;
42
 right: 1rem;
43
 display: block;
44
 transform: translateY(1rem);
45
 transition-property: transform;
46
 transition-duration: var(--md-sys-motion-duration-300);
47
 white-space: nowrap;
48
 text-overflow: ellipsis;
49
 overflow: hidden;
50
 color: var(--md-sys-color-on-surface-variant);
51
 font-family: var(--md-sys-typescale-body-large-font);
52
 font-weight: var(--md-sys-typescale-body-large-weight);
53
 font-size: var(--md-sys-typescale-body-large-size);
54
 font-style: var(--md-sys-typescale-body-large-font-style);
55
 letter-spacing: var(--md-sys-typescale-body-large-tracking);
56
 line-height: var(--md-sys-typescale-body-large-line-height);
57
 text-transform: var(--md-sys-typescale-body-large-text-transform);
58
 text-decoration: var(--md-sys-typescale-body-large-text-decoration);
59
}
60
61
.md-filled-text-field :not(:placeholder-shown)+span,
62
.md-filled-text-field :not(:placeholder-shown)+label,
63
.md-filled-text-field .populated+span,
64
.md-filled-text-field .populated+label,
65
.md-filled-text-field:focus-within span,
66
.md-filled-text-field:focus-within label,
67
.md-filled-text-field.float span,
68
.md-filled-text-field.float label {
69
 transform: translateY(0);
70
 font-family: var(--md-sys-typescale-body-small-font);
71
 font-weight: var(--md-sys-typescale-body-small-weight);
72
 font-size: var(--md-sys-typescale-body-small-size);
73
 font-style: var(--md-sys-typescale-body-small-font-style);
74
 letter-spacing: var(--md-sys-typescale-body-small-tracking);
75
 line-height: var(--md-sys-typescale-body-small-line-height);
76
 text-transform: var(--md-sys-typescale-body-small-text-transform);
77
 text-decoration: var(--md-sys-typescale-body-small-text-decoration);
78
}
79
80
.md-filled-text-field :not(label, span, small) {
81
 position: relative;
82
 caret-color: var(--md-sys-color-primary);
83
 min-height: 2rem;
84
 box-sizing: border-box;
85
 padding-left: 1rem;
86
 padding-bottom: 0.5rem;
87
 padding-right: 1rem;
88
 border: none;
89
 resize: none;
90
 color: var(--md-sys-color-on-surface);
91
 font-family: var(--md-sys-typescale-body-large-font);
92
 font-weight: var(--md-sys-typescale-body-large-weight);
93
 font-size: var(--md-sys-typescale-body-large-size);
94
 font-style: var(--md-sys-typescale-body-large-font-style);
95
 letter-spacing: var(--md-sys-typescale-body-large-tracking);
96
 line-height: var(--md-sys-typescale-body-large-line-height);
97
 text-transform: var(--md-sys-typescale-body-large-text-transform);
98
 text-decoration: var(--md-sys-typescale-body-large-text-decoration);
99
 background-color: transparent;
100
 outline: none;
101
 border-bottom-width: 0.0625rem;
102
 border-bottom-style: solid;
103
 border-bottom-color: var(--md-sys-color-on-surface-variant);
104
}
105
106
.md-filled-text-field ::placeholder {
107
 color: transparent;
108
}
109
110
.md-filled-text-field small {
111
 display: block;
112
 color: var(--md-sys-color-on-surface-variant);
113
 background-color: var(--md-sys-color-background);
114
 font-family: var(--md-sys-typescale-body-small-font);
115
 font-weight: var(--md-sys-typescale-body-small-weight);
116
 font-size: var(--md-sys-typescale-body-small-size);
117
 font-style: var(--md-sys-typescale-body-small-font-style);
118
 letter-spacing: var(--md-sys-typescale-body-small-tracking);
119
 line-height: var(--md-sys-typescale-body-small-line-height);
120
 text-transform: var(--md-sys-typescale-body-small-text-transform);
121
 text-decoration: var(--md-sys-typescale-body-small-text-decoration);
122
 padding: 0.25rem 1rem 0 1rem;
123
 white-space: nowrap;
124
 text-overflow: ellipsis;
125
 overflow: hidden;
126
}
127
128
.md-filled-text-field:hover span,
129
.md-filled-text-field:hover label {
130
 color: var(--md-sys-color-on-surface-variant);
131
}
132
133
.md-filled-text-field:hover :not(label, span, small) {
134
 padding-bottom: 0.5rem;
135
 border-bottom-width: 0.0625rem;
136
 border-bottom-color: var(--md-sys-color-on-surface);
137
}
138
139
.md-filled-text-field:hover::after {
140
 background-color: var(--md-sys-color-on-surface);
141
 opacity: var(--md-sys-state-hover-state-layer-opacity);
142
}
143
144
.md-filled-text-field:hover small {
145
 color: var(--md-sys-color-on-surface-variant);
146
}
147
148
.md-filled-text-field:focus-within span,
149
.md-filled-text-field:focus-within label {
150
 color: var(--md-sys-color-primary);
151
}
152
153
.md-filled-text-field :focus {
154
 color: var(--md-sys-color-on-surface);
155
 outline: none;
156
 padding-bottom: 0.4375rem;
157
 border-bottom-width: 0.125rem;
158
 border-bottom-color: var(--md-sys-color-primary);
159
}
160
161
.md-filled-text-field:hover :focus {
162
 padding-bottom: 0.4375rem;
163
 border-bottom-width: 0.125rem;
164
}
165
166
.md-filled-text-field:focus-within small {
167
 color: var(--md-sys-color-on-surface-variant);
168
}
169
170
.md-filled-text-field :invalid {
171
 color: var(--md-sys-color-on-surface);
172
 border-bottom-color: var(--md-sys-color-error);
173
}
174
175
.md-filled-text-field :invalid+span,
176
.md-filled-text-field :invalid+label {
177
 color: var(--md-sys-color-error);
178
}
179
180
.md-filled-text-field :invalid~small,
181
.md-filled-text-field:hover :invalid~small,
182
.md-filled-text-field:focus-within .input-text:invalid~small {
183
 color: var(--md-sys-color-error);
184
}
185
186
.md-filled-text-field :invalid:focus {
187
 caret-color: var(--md-sys-color-error);
188
 border-bottom-color: var(--md-sys-color-error);
189
}
190
191
.md-filled-text-field:hover :invalid {
192
 color: var(--md-sys-color-on-surface);
193
 border-bottom-color: var(--md-sys-color-error);
194
}
skip_previous skip_next