An accordion is a UI component that consists of a vertical stack of headers that can be expanded or collapsed to reveal or hide associated content sections.
You can set the default open item by passing the defaultOpenId prop to the Accordion component.
By default, multiple prop is set to false. So, set defaultOpenId as a string:
multiple prop is set to true, set defaultOpenId as an array of strings:openId stateYou can control Accordion state with openId and onChange props.
By default, multiple prop is set to false. So, set openId as string:
multiple prop is set to true, set openId as an array of strings:Accordion supports 4 sizes sm, md, lg and responsive and can be changed by passing the size prop.
Default size is lg.
responsive, the component will be responsive to the viewport.Screen prefix | Screen width | Component size |
|---|---|---|
|
| sm |
|
| md |
|
| lg |
arrowPosition prop on the Accordion component.right.AccordionControl labelarrowIcon prop on the AccordionControl component to change the indicator icon. The component handles the turning transition automatically.disabled prop to true on AccordionItem component.stacked prop to true.separated.AccordionProps type exported from @ocean-network-express/magenta-ui/react is a generic, it accepts boolean type that describes multiple state:Accordion follows WAI-ARIA recommendations:
Key | Description |
|---|---|
| Moves focus to next item |
| Moves focus to previous item |
| Moves focus to first item |
| Moves focus to last item |
| Toggles focused item opened state |