Skip to content

Commit d1ea367

Browse files
committed
docs(demo/readme): add state override warnings
1 parent 24230e1 commit d1ea367

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ Allow the only remaining expanded item to be collapsed.
9797
9898
#### preExpanded: `string[]` [_optional_, default: `[]`]
9999
100-
Accepts an array of strings and any `AccordionItem` whose `uuid` prop matches any one
101-
of these strings will be expanded on mount.
100+
Accepts an array of strings and any `AccordionItem` whose `uuid` prop matches
101+
any one of these strings will be expanded on mount.
102102
103103
#### className : `string` [*optional*, default: `'accordion'`]
104104
@@ -121,6 +121,12 @@ Class(es) to apply to element.
121121
122122
Recommended for use with `onChange`. Will be auto-generated if not provided.
123123
124+
#### dangerouslySetExpanding: `boolean` [*optional*]
125+
126+
Enables external control of the expansion.
127+
128+
> Warning: This may impact accessibility negatively, use at your own risk
129+
124130
---
125131
126132
### AccordionItemHeading

demo/src/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,14 @@ const App = (): JSX.Element => (
209209

210210
<Accordion>
211211
{placeholders.map((placeholder: Placeholder, i: number) => {
212-
const dangerouslySetExpanded = i < 2 ? true : false;
212+
const isExpanded = i < 2;
213213

214214
return (
215215
<AccordionItem
216216
key={placeholder.heading}
217217
uuid={placeholder.uuid}
218-
dangerouslySetExpanded={dangerouslySetExpanded}
218+
// Warning: This can impact accessibility negatively
219+
dangerouslySetExpanded={isExpanded}
219220
>
220221
<AccordionItemHeading>
221222
<AccordionItemButton>

0 commit comments

Comments
 (0)