Skip to content

Commit f2dfea4

Browse files
docs: document defaultOpen property for Accordion component
Co-Authored-By: Niels Swimberghe <[email protected]>
1 parent 52df357 commit f2dfea4

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

fern/products/docs/pages/component-library/default-components/accordion-groups.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: 'Display expandable/collapsible options that reveal more informatio
66
Accordion Groups allow you to organize content into collapsible sections, making it easier for users to navigate through information. With recent updates, our Accordion component now supports improved search functionality using the browser's built-in search feature.
77

88
<AccordionGroup>
9-
<Accordion title="Basic usage">
9+
<Accordion title="Basic usage" defaultOpen={true}>
1010
Accordion Groups can contain multiple Accordion items. Each item has a title and content that can be expanded or collapsed.
1111

1212
```jsx
@@ -28,6 +28,21 @@ Accordion Groups allow you to organize content into collapsible sections, making
2828
<Accordion title="Accessibility">
2929
Our Accordion component is built with accessibility in mind, supporting keyboard navigation and screen readers.
3030
</Accordion>
31+
32+
<Accordion title="Default open state">
33+
You can use the `defaultOpen` property to have specific accordions expanded by default when the page loads. This is useful for highlighting important information or frequently accessed content.
34+
35+
```jsx
36+
<AccordionGroup>
37+
<Accordion title="Important Information" defaultOpen={true}>
38+
This accordion will be open by default
39+
</Accordion>
40+
<Accordion title="Additional Details">
41+
This accordion will be closed by default
42+
</Accordion>
43+
</AccordionGroup>
44+
```
45+
</Accordion>
3146
</AccordionGroup>
3247

3348
### Enhanced search functionality

fern/products/docs/pages/component-library/default-components/accordions.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ The Accordion component allows you to create expandable sections in your documen
1010
<Accordion title='Single Accordion'>
1111
This is an example of an accordion component. When clicked, it expands to reveal this additional content.
1212
</Accordion>
13+
<Accordion title='Accordion Open by Default' defaultOpen={true}>
14+
This accordion is open by default using the `defaultOpen` property.
15+
</Accordion>
1316
</Tab>
1417
<Tab title="Markdown">
1518
```jsx
1619
<Accordion title='Single Accordion'>
1720
This is an example of an accordion component. When clicked, it expands to reveal this additional content.
1821
</Accordion>
22+
23+
<Accordion title='Accordion Open by Default' defaultOpen={true}>
24+
This accordion is open by default using the `defaultOpen` property.
25+
</Accordion>
1926
```
2027
</Tab>
2128
</Tabs>
@@ -30,4 +37,8 @@ The Accordion component allows you to create expandable sections in your documen
3037
The content to be displayed when the accordion is expanded. Can include text, markdown, and components.
3138
</ParamField>
3239

40+
<ParamField path="defaultOpen" type="boolean" default={false}>
41+
Whether the accordion should be open by default when the page loads. If not specified, the accordion will be collapsed by default.
42+
</ParamField>
43+
3344

0 commit comments

Comments
 (0)