Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[collapsible][accordion] Add keepMounted prop #807

Closed
wants to merge 14 commits into from
1 change: 1 addition & 0 deletions docs/data/api/accordion-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"hiddenUntilFound": { "type": { "name": "bool" }, "default": "false" },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
"name": "AccordionPanel",
Expand Down
2 changes: 2 additions & 0 deletions docs/data/api/accordion-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"default": "0"
},
"disabled": { "type": { "name": "bool" }, "default": "false" },
"hiddenUntilFound": { "type": { "name": "bool" }, "default": "false" },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"loop": { "type": { "name": "bool" }, "default": "true" },
"onValueChange": { "type": { "name": "func" } },
"openMultiple": { "type": { "name": "bool" }, "default": "true" },
Expand Down
1 change: 1 addition & 0 deletions docs/data/api/collapsible-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"props": {
"className": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;string" } },
"hiddenUntilFound": { "type": { "name": "bool" }, "default": "false" },
"keepMounted": { "type": { "name": "bool" }, "default": "false" },
"render": { "type": { "name": "union", "description": "element<br>&#124;&nbsp;func" } }
},
"name": "CollapsiblePanel",
Expand Down
59 changes: 59 additions & 0 deletions docs/data/components/accordion/AccordionIntroduction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use client';
import * as React from 'react';
import { Accordion } from '@base-ui-components/react/accordion';
import classes from './styles.module.css';

export default function AccordionIntroduction() {
return (
<Accordion.Root className={classes.root} aria-label="Base UI Accordion">
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 1
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 1
</Accordion.Panel>
</Accordion.Item>
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 2
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 2
</Accordion.Panel>
</Accordion.Item>
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 3
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 3
</Accordion.Panel>
</Accordion.Item>
</Accordion.Root>
);
}

function ExpandMoreIcon(props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
className={classes.icon}
{...props}
>
<path d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z" fill="currentColor" />
</svg>
);
}
59 changes: 59 additions & 0 deletions docs/data/components/accordion/AccordionIntroduction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use client';
import * as React from 'react';
import { Accordion } from '@base-ui-components/react/accordion';
import classes from './styles.module.css';

export default function AccordionIntroduction() {
return (
<Accordion.Root className={classes.root} aria-label="Base UI Accordion">
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 1
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 1
</Accordion.Panel>
</Accordion.Item>
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 2
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 2
</Accordion.Panel>
</Accordion.Item>
<Accordion.Item className={classes.item}>
<Accordion.Header className={classes.header}>
<Accordion.Trigger className={classes.trigger}>
Trigger 3
<ExpandMoreIcon />
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Panel className={classes.panel}>
This is the contents of Accordion.Panel 3
</Accordion.Panel>
</Accordion.Item>
</Accordion.Root>
);
}

function ExpandMoreIcon(props: React.SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
className={classes.icon}
{...props}
>
<path d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z" fill="currentColor" />
</svg>
);
}
61 changes: 0 additions & 61 deletions docs/data/components/accordion/UnstyledAccordionIntroduction.js

This file was deleted.

This file was deleted.

Loading
Loading