-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch.html
More file actions
75 lines (70 loc) · 1.78 KB
/
switch.html
File metadata and controls
75 lines (70 loc) · 1.78 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>µCSS — Switch</title>
<link rel="stylesheet" href="../dist/mu.css">
</head>
<body>
<main class="container">
<hgroup>
<h1>Switch</h1>
<p>Toggle switches using <code><input type="checkbox" role="switch"></code>.</p>
</hgroup>
<p><a href="index.html">← Back to examples</a></p>
<p><button class="btn btn-sm btn-secondary" onclick="document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark'">Toggle dark mode</button></p>
<section>
<h2>Basic switch</h2>
<label>
<input type="checkbox" role="switch">
Enable notifications
</label>
<label>
<input type="checkbox" role="switch" checked>
Dark mode
</label>
</section>
<section>
<h2>Disabled</h2>
<label>
<input type="checkbox" role="switch" disabled>
Disabled off
</label>
<label>
<input type="checkbox" role="switch" disabled checked>
Disabled on
</label>
</section>
<section>
<h2>With validation</h2>
<label>
<input type="checkbox" role="switch" aria-invalid="false" checked>
Valid switch
</label>
<label>
<input type="checkbox" role="switch" aria-invalid="true">
Invalid switch
</label>
</section>
<section>
<h2>In a form context</h2>
<article>
<header>Preferences</header>
<label>
<input type="checkbox" role="switch" checked>
Receive email updates
</label>
<label>
<input type="checkbox" role="switch">
Make profile public
</label>
<label>
<input type="checkbox" role="switch" checked>
Enable two-factor authentication
</label>
</article>
</section>
</main>
</body>
</html>