-
Notifications
You must be signed in to change notification settings - Fork 339
/
Copy pathaccordion.yaml
132 lines (129 loc) · 4.13 KB
/
accordion.yaml
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
params:
- name: id
type: string
required: true
description: Must be **unique** across the domain of your service (as the expanded state of individual instances of the component persists across page loads using [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)). Used as an `id` in the HTML for the accordion as a whole, and also as a prefix for the `id`s of the section contents and the buttons that open them, so that those `id`s can be the target of `aria-labelledby` and `aria-control` attributes.
- name: headingLevel
type: integer
required: false
description: Heading level, from 1 to 6. Default is `2`.
- name: classes
type: string
required: false
description: Classes to add to the accordion.
- name: attributes
type: object
required: false
description: HTML attributes (for example data attributes) to add to the accordion.
- name: items
type: array
required: true
description: An array of sections within the accordion.
params:
- name: heading.text
type: string
required: false
description: The title of each section. If `heading.html` is supplied, this is ignored. This is used both as the title for each section, and as the button to open or close each section.
- name: heading.html
type: string
required: false
description: The HTML content of the header for each section which is used both as the title for each section, and as the button to open or close each section.
- name: summary.text
type: string
required: false
description: Text content for summary line. If `summary.html` is supplied, this is ignored.
- name: summary.html
type: string
required: false
description: HTML content for summary line.
- name: content.html
type: string
required: true
description: The HTML content of each section, which is hidden when the section is closed.
- name: expanded
type: boolean
required: false
description: Whether the section should be expanded upon initial load or not. Defaults to `false`.
examples:
- name: default
data:
id: default-example
classes: myClass
attributes:
data-attribute: value
items:
- heading:
text: Section A
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 1</li>
</ul>
- heading:
text: Section B
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 2</li>
</ul>
- name: with additional descriptions
data:
id: with-descriptions
items:
- heading:
text: Test
summary:
text: Additional description
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 1</li>
</ul>
- heading:
text: Test 2
summary:
html: <span class="govuk-!-font-weight-regular">Additional description</span>
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 2</li>
</ul>
- name: with one section open
data:
id: one-section-open-example
items:
- heading:
text: Section A
expanded: true
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 1</li>
</ul>
- heading:
text: Section B
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 2</li>
</ul>
- name: with all sections already open
data:
id: all-sections-open-example
items:
- heading:
text: Section A
expanded: true
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 1</li>
</ul>
- heading:
text: Section B
expanded: true
content:
html: |
<ul class="govuk-list govuk-list--bullet">
<li>Example item 2</li>
</ul>