A component for showing and hiding content with animation.
import { Accordion, AccordionTrigger, AccordionPanel } from '@backstage/ui';
<Accordion>
<AccordionTrigger title="Toggle Panel" />
<AccordionPanel>Your content</AccordionPanel>
</Accordion>Root container for the accordion. Renders a <div> element.
| Prop | Type | Default | Responsive |
|---|---|---|---|
| children | ReactNode(state: { isExpanded: boolean }) => ReactNode | - | No |
| defaultExpanded | boolean | false | No |
| isExpanded | boolean | - | No |
| onExpandedChange | (isExpanded: boolean) => void | - | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Trigger component with built-in animated chevron icon. Renders a heading element (defaults to <h3>, configurable via level prop) wrapping a <button>.
| Prop | Type | Default | Responsive |
|---|---|---|---|
| level | 123456 | 3 | No |
| title | string | - | No |
| subtitle | string | - | No |
| children | ReactNode | - | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Panel with the accordion content. Renders a <div> element.
| Prop | Type | Default | Responsive |
|---|---|---|---|
| className | string | - | No |
| style | CSSProperties | - | No |
Container for managing multiple accordions. Renders a <div> element.
| Prop | Type | Default | Responsive |
|---|---|---|---|
| allowsMultiple | boolean | false | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Here's a view when using both title and subtitle props.
Here's a view when providing custom multi-line content as children.
Here's a view when the panel is expanded by default.
It's the edge of the world and all of Western civilization
The sun may rise in the East, at least it settled in a final location
It's understood that Hollywood sells Californication
Here's a view when only one accordion can be open at a time.
Here's a view when multiple accordions can be open simultaneously.
Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.
bui-Accordionbui-AccordionTriggerbui-AccordionTriggerButtonbui-AccordionTriggerTitlebui-AccordionTriggerSubtitlebui-AccordionTriggerIconbui-AccordionPanelbui-AccordionGroup0.9.0 - BREAKING: Removed Collapsible component. Migrate to Accordion or use React Aria Disclosure.Accordion provides preset styling with a similar component structure.
- import { Collapsible } from '@backstage/ui';
+ import { Accordion, AccordionTrigger, AccordionPanel } from '@backstage/ui';
- <Collapsible.Root>
- <Collapsible.Trigger render={(props) => <Button {...props}>Toggle</Button>} />
- <Collapsible.Panel>Content</Collapsible.Panel>
- </Collapsible.Root>
+ <Accordion>
+ <AccordionTrigger title="Toggle" />
+ <AccordionPanel>Content</AccordionPanel>
+ </Accordion>
CSS classes: .bui-CollapsibleRoot → .bui-Accordion, .bui-CollapsibleTrigger → .bui-AccordionTrigger (now on heading element), .bui-CollapsiblePanel → .bui-AccordionPanel
For custom styling without preset styles:
import { Disclosure, Button, DisclosurePanel } from 'react-aria-components';
<Disclosure>
<Button slot="trigger">Toggle</Button>
<DisclosurePanel>Content</DisclosurePanel>
</Disclosure>;
``` [#31493](https://github.com/backstage/backstage/pull/31493)