You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/src/routes/docs/headless/accordion/index.mdx
+70-5Lines changed: 70 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,23 +14,84 @@ A set of interactive sections that show or hide connected information.
14
14
15
15
<Showcasename="hero" />
16
16
17
-
## Initial Value
17
+
<FeatureList
18
+
features={[
19
+
'Follows the WAI-Aria design pattern',
20
+
'Full keyboard navigation',
21
+
'Can open one or multiple items at a time',
22
+
'Supports initial and reactive values',
23
+
]}
24
+
/>
25
+
26
+
## Building blocks
27
+
28
+
<CodeSnippetname="building-blocks.tsx" />
29
+
30
+
### 🎨 Anatomy
31
+
32
+
<AnatomyTable
33
+
propDescriptors={[
34
+
{
35
+
name: 'Accordion.Root',
36
+
description: 'The primary container for the accordion.',
37
+
},
38
+
{
39
+
name: 'Accordion.Item',
40
+
description: 'A single disclosure widget.',
41
+
},
42
+
{
43
+
name: 'Accordion.Header',
44
+
description: 'The heading element of an accordion item.',
45
+
},
46
+
{
47
+
name: 'Accordion.Trigger',
48
+
description: 'Activates to show or hide the accordion content.',
49
+
},
50
+
{
51
+
name: 'Accordion.Content',
52
+
description: 'Displays the content when its connected trigger is actived.',
53
+
},
54
+
]}
55
+
/>
56
+
57
+
## Why use a headless accordion?
58
+
59
+
While you can create a native disclosure with HTML elements like `details` and `summary`, there are some limitations and issues with them.
60
+
61
+
### Native disclosure pain points
62
+
63
+
<FeatureList
64
+
issues={[
65
+
'Cannot control multiple disclosures at once',
66
+
'Inconsistent accessible name computation',
67
+
'Unintuitive role announcements',
68
+
'Connected information is hard to find with AT',
69
+
]}
70
+
/>
71
+
72
+
Qwik UI includes a headless Accordion component that uses ARIA and JavaScript to enhance accessibility and usability for managing multiple sections smoothly.
73
+
74
+
> For more information on the inconsistencies of these native elements, see Scott O'Hara's [The details and summary elements, again](https://www.scottohara.me/blog/2022/09/12/details-summary.html) article.
75
+
76
+
## Component State
77
+
78
+
## Initial value
18
79
19
80
<Showcasename="initial" />
20
81
21
-
## Reactive
82
+
## Reactive value
22
83
23
84
<Showcasename="reactive" />
24
85
25
-
## Programmatic
86
+
## Programmatic changes
26
87
27
88
<Showcasename="programmatic" />
28
89
29
-
## Handle Change
90
+
## Handling selection changes
30
91
31
92
<Showcasename="on-change" />
32
93
33
-
## Disabled
94
+
## Disabled items
34
95
35
96
<Showcasename="disabled" />
36
97
@@ -45,3 +106,7 @@ A set of interactive sections that show or hide connected information.
0 commit comments