-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails examples.html
69 lines (65 loc) · 2.47 KB
/
details examples.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>details-menu demo</title>
<style>
details-menu {
background: white;
border: 1px solid;
display: block;
padding: 4px;
width: 200px;
}
button, label[tabindex] {
font-family: inherit;
font-size: inherit;
display: block;
background: none;
border: 0;
width: 100%;
text-align: left;
padding: 0;
}
</style>
</head>
<body>
<details>
<summary>Best robot: <span data-menu-button>Unknown</span></summary>
<details-menu>
<button type="button" role="menuitem" data-menu-button-text>Hubot</button>
<button type="button" role="menuitem" data-menu-button-text>Bender</button>
<button type="button" role="menuitem" data-menu-button-text>BB-8</button>
</details-menu>
</details>
<details>
<summary>Best robot: <span data-menu-button>Unknown</span></summary>
<details-menu>
<label tabindex="0" role="menuitemradio" data-menu-button-text><input type="radio" name="robot"> Hubot</label>
<label tabindex="0" role="menuitemradio" data-menu-button-text><input type="radio" name="robot"> Bender</label>
<label tabindex="0" role="menuitemradio" data-menu-button-text><input type="radio" name="robot"> BB-8</label>
</details-menu>
</details>
<details>
<summary>Favorite robots</summary>
<details-menu>
<label tabindex="0" role="menuitemcheckbox"><input type="checkbox" name="robot"> Hubot</label>
<label tabindex="0" role="menuitemcheckbox"><input type="checkbox" name="robot"> Bender</label>
<label tabindex="0" role="menuitemcheckbox"><input type="checkbox" name="robot"> BB-8</label>
</details-menu>
</details>
<details>
<summary data-menu-button>Favorite robots</summary>
<details-menu>
<button type="submit" name="robot" value="Hubot" role="menuitemradio" data-menu-button-text>Hubot</button>
<button type="submit" name="robot" value="Bender" role="menuitemradio" data-menu-button-text>Bender</button>
<button type="submit" name="robot" value="BB-8" role="menuitemradio" data-menu-button-text>BB-8</button>
</details-menu>
</details>
<script type="text/javascript">
document.addEventListener('details-menu-selected', e => console.log(e))
</script>
<!-- <script type="module" src="../dist/index.js"></script> -->
<script type="module" src="https://unpkg.com/@github/details-menu-element@latest?module"></script>
</body>
</html>