-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccordion.html
More file actions
81 lines (77 loc) · 2.39 KB
/
accordion.html
File metadata and controls
81 lines (77 loc) · 2.39 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>µCSS — Accordion</title>
<link rel="stylesheet" href="../dist/mu.css">
</head>
<body>
<main class="container">
<hgroup>
<h1>Accordion</h1>
<p>Collapsible sections built with native <code><details></code> elements.</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 accordion</h2>
<div class="accordion">
<details open>
<summary>Section One</summary>
<p>This section is open by default. The accordion uses native HTML <code><details></code> and <code><summary></code> elements — no JavaScript required for basic functionality.</p>
</details>
<details>
<summary>Section Two</summary>
<p>Each section can contain any HTML content. The chevron indicator rotates when the section is expanded.</p>
</details>
<details>
<summary>Section Three</summary>
<p>Sections are separated by borders automatically. The first and last items get rounded corners from the container.</p>
</details>
</div>
</section>
<section>
<h2>All sections closed</h2>
<div class="accordion">
<details>
<summary>First item</summary>
<p>Content for the first item.</p>
</details>
<details>
<summary>Second item</summary>
<p>Content for the second item.</p>
</details>
<details>
<summary>Third item</summary>
<p>Content for the third item.</p>
</details>
</div>
</section>
<section>
<h2>Rich content</h2>
<div class="accordion">
<details open>
<summary>With nested elements</summary>
<p>Accordions can contain any HTML:</p>
<ul>
<li>Unordered lists</li>
<li>Paragraphs and <strong>inline formatting</strong></li>
<li>Any block-level content</li>
</ul>
</details>
<details>
<summary>With a table</summary>
<table>
<thead><tr><th>Name</th><th>Value</th></tr></thead>
<tbody>
<tr><td>Alpha</td><td>100</td></tr>
<tr><td>Beta</td><td>200</td></tr>
</tbody>
</table>
</details>
</div>
</section>
</main>
</body>
</html>