File tree Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Expand file tree Collapse file tree 3 files changed +58
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ Read more about [SUIT CSS](https://github.com/suitcss/suit/).
23
23
24
24
* ` FormField ` - Containing element. Apply state classes to this
25
25
* ` FormField-input ` - Consistent rendering of various form inputs
26
+ * ` FormField-select ` - Used for select elements only (instead of ` FormField-input ` )
26
27
* ` FormField-label ` - Label text for the input
27
28
* ` FormField-text ` - Used to display help text or validation messages
28
29
* ` FormField-check ` - Wraps around ` input ` and ` label ` when using either radio
@@ -48,6 +49,21 @@ This works with other inputs such as `textarea`, `range` and `file`.
48
49
</div >
49
50
```
50
51
52
+ ### Select elements
53
+
54
+ Select elements require their own class name to ensure consistent rendering in
55
+ Blink/Webkit.
56
+
57
+ ``` html
58
+ <div class =" FormField" >
59
+ <label class =" FormField-label" for =" select" >Select</label >
60
+ <select class =" FormField-select" >
61
+ <option >Some option</option >
62
+ <option >Another option</option >
63
+ </select >
64
+ </div >
65
+ ```
66
+
51
67
### Using a ` label ` container
52
68
53
69
``` html
@@ -154,6 +170,10 @@ The following achieves an inline form effect
154
170
* ` --FormField-text-fontSize `
155
171
* ` --FormField-text-marginTop `
156
172
173
+ #### ` FormField-select `
174
+
175
+ * ` --FormField-select-height `
176
+
157
177
#### ` FormField-check `
158
178
159
179
* ` --FormField-check-gutter ` - Space between checkbox/radio and the label
Original file line number Diff line number Diff line change 22
22
--FormField-text-fontSize : inherit;
23
23
--FormField-text-marginTop : 0.25em ;
24
24
25
+ --FormField-select-height : 30px ;
26
+
25
27
--FormField-check-gutter : 0.5em ;
26
28
27
29
/* States */
43
45
margin-top : 0 ;
44
46
}
45
47
48
+ .FormField-select ,
46
49
.FormField-input {
47
50
background-color : # fff ;
48
51
border-color : var (--FormField-input-borderColor );
59
62
width : 100% ;
60
63
}
61
64
65
+ /*
66
+ * Control height manually on select elements as Webkit/Blink does not respect
67
+ * padding values
68
+ */
69
+
70
+ .FormField-select : not ([size ]): not ([multiple ]) {
71
+ height : var (--FormField-select-height );
72
+ }
73
+
62
74
/*
63
75
* Remove native search input styling
64
76
*/
121
133
* Validation states
122
134
*/
123
135
124
- .FormField .is-error .FormField-input {
136
+ .FormField .is-error .FormField-input ,
137
+ .FormField .is-error .FormField-select {
125
138
border-color : var (--FormField-onError-color );
126
139
}
127
140
130
143
color : var (--FormField-onError-color );
131
144
}
132
145
133
- .FormField .is-warning .FormField-input {
146
+ .FormField .is-warning .FormField-input ,
147
+ .FormField .is-warning .FormField-select {
134
148
border-color : var (--FormField-onWarning-color );
135
149
}
136
150
139
153
color : var (--FormField-onWarning-color );
140
154
}
141
155
142
- .FormField .is-success .FormField-input {
156
+ .FormField .is-success .FormField-input ,
157
+ .FormField .is-success .FormField-select {
143
158
border-color : var (--FormField-onSuccess-color );
144
159
}
145
160
Original file line number Diff line number Diff line change @@ -34,6 +34,26 @@ <h3 class="Test-it">should render a label and input</h3>
34
34
< input class ="FormField-input " type ="file " id ="file ">
35
35
</ div >
36
36
37
+ < div class ="FormField ">
38
+ < label class ="FormField-label " for ="select "> Select</ label >
39
+ < select class ="FormField-select " id ="select " name ="select ">
40
+ < option value ="a "> Some option</ option >
41
+ < option value ="b "> Another option</ option >
42
+ </ select >
43
+ </ div >
44
+
45
+ < div class ="FormField ">
46
+ < label class ="FormField-label " for ="select-multi "> Select multiple</ label >
47
+ < select class ="FormField-select " size ="6 " multiple id ="select-multi " name ="multiple ">
48
+ < option value ="American "> American flamingo</ option >
49
+ < option value ="Andean "> Andean flamingo</ option >
50
+ < option value ="Chilean "> Chilean flamingo</ option >
51
+ < option value ="Greater "> Greater flamingo</ option >
52
+ < option value ="James's "> James's flamingo</ option >
53
+ < option value ="Lesser "> Lesser flamingo</ option >
54
+ </ select >
55
+ </ div >
56
+
37
57
< div class ="FormField ">
38
58
< label class ="FormField-label " for ="password "> Password</ label >
39
59
< input class ="FormField-input " type ="password " id ="password ">
You can’t perform that action at this time.
0 commit comments