forked from muicss/mui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.html
More file actions
283 lines (265 loc) · 9.07 KB
/
forms.html
File metadata and controls
283 lines (265 loc) · 9.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../assets/mui/css/mui.css"/>
<script>
window.addEventListener('load', function() {
var s = document.createElement('script');
s.src = "../assets/mui/js/mui.js";
document.head.appendChild(s);
var el = document.getElementsByTagName('select')[0];
el.onchange = function() {
console.log('select onchange');
};
el.addEventListener('change', function() {
console.log('select change');
});
});
</script>
</head>
<body>
<div class="mui-container">
<h2>Forms</h2>
<div class="mui-panel">
<h3>Form with placeholders</h3>
<form>
<div class="mui-textfield">
<input type="text" placeholder="Placeholder 1">
</div>
<div class="mui-textfield">
<input type="text" placeholder="Placeholder 2">
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
<h3>Form with fixed labels</h3>
<form>
<div class="mui-textfield">
<input type="text">
<label>Input 1</label>
</div>
<div class="mui-textfield">
<input type="text">
<label>Input 2</label>
</div>
<div class="mui-textfield">
<textarea></textarea>
<label>Textarea</label>
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
<h3>Form with floating labels</h3>
<form>
<div class="mui-textfield mui-textfield--float-label">
<input type="text" autofocus>
<label>Auto focused</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="text">
<label>Placeholder</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="text" value="Value on load">
<label>Placeholder</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<textarea>Value on load</textarea>
<label>Placeholder</label>
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
<h3>Label overflow</h3>
<form>
<div class="mui-textfield mui-textfield--wrap-label">
<input type="text">
<label>Very long long long long long long label</label>
</div>
<div class="mui-textfield">
<input type="text">
<label>Very long long long long long long label</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="text">
<label>Very long long long long long long label</label>
</div>
</form>
<h3>Checkboxes and radios</h3>
<form>
<div class="mui-checkbox">
<label>
<input type="checkbox" value="" checked>
Active (Checked)
</label>
</div>
<div class="mui-checkbox">
<label>
<input type="checkbox" value="">
Active (Unchecked)
</label>
</div>
<div class="mui-checkbox">
<label>
<input type="checkbox" value="" checked disabled>
Disabled (Checked)
</label>
</div>
<div class="mui-checkbox">
<label>
<input type="checkbox" value="" disabled>
Disabled (Unchecked)
</label>
</div>
<div class="mui-radio">
<label>
<input type="radio"
name="optionsRadios1"
id="optionsRadios1"
value="option1"
checked>
Active (Checked)
</label>
</div>
<div class="mui-radio">
<label>
<input type="radio"
name="optionsRadios2"
id="optionsRadios2"
value="option2">
Active (Unchecked)
</label>
</div>
<div class="mui-radio">
<label>
<input type="radio"
name="optionsRadios3"
id="optionsRadios3"
value="option3"
checked
disabled>
Disabled (Checked)
</label>
</div>
<div class="mui-radio">
<label>
<input type="radio"
name="optionsRadios4"
id="optionsRadios3"
value="option3"
disabled>
Disabled (Unchecked)
</label>
</div>
</form>
<h3>Select</h3>
<form>
<div class="mui-select">
<select>
<option>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</div>
<div class="mui-select">
<select disabled>
<option>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</div>
</form>
<h3>Inline Form</h3>
<form class="mui-form--inline">
<div class="mui-textfield">
<input type="text">
</div>
<button class="mui-btn">submit</button>
</form>
<form class="mui-form--inline">
<div class="mui-select">
<select>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</div>
<div class="mui-textfield">
<input type="text" placeholder="Placeholder">
</div>
</form>
<h3>Form Validation</h3>
<form>
<div class="mui-textfield">
<input type="email" placeholder="Email address">
</div>
<div class="mui-textfield">
<input type="email">
<label>Email address</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="email" value="err">
<label>Email address</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="text" required>
<label>Text *</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="email" required>
<label>Email address *</label>
</div>
<div class="mui-textfield">
<input type="email" required>
<label>Email address *</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="email" value="err" required>
<label>Email address *</label>
</div>
<div class="mui-textfield">
<input type="email" class="mui--is-not-empty" value="err" placeholder="Email address *" required>
</div>
<button class="mui-btn">submit</button>
</form>
<h3>Manual Form Validation</h3>
<form>
<div class="mui-textfield">
<input class="mui--is-invalid" type="text" placeholder="Email address">
</div>
<div class="mui-textfield">
<input class="mui--is-invalid" type="text">
<label>Email address</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input class="mui--is-invalid" type="text" value="err">
<label>Email address</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input class="mui--is-invalid" type="text">
<label>Text *</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input class="mui--is-invalid" type="text">
<label>Email address *</label>
</div>
<div class="mui-textfield">
<input class="mui--is-invalid" type="text">
<label>Email address *</label>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input class="mui--is-invalid" type="text" value="err">
<label>Email address *</label>
</div>
<div class="mui-textfield">
<input class="mui--is-invalid" type="text" value="err" placeholder="Email address *">
</div>
<button class="mui-btn">submit</button>
</form>
</div>
</div>
</body>
</html>