Accordion
Properties
- title
(string | jsx.JSX.Element)
:
The title of the accordion, displayed in both collapsed and expanded states. It can be a string or a JSX element.
- children
(jsx.JSX.Element)
:
The content of the accordion that will be shown when expanded. This can be any JSX element.
- closed
(boolean, default: false)
:
Determines the initial state of the accordion: collapsed true
or expanded false
.
Events
- toggleHandler:
A handler that is called when clicking on the accordion's title. It toggles the state of the accordion between collapsed and expanded.
- onMount:
An event that triggers when the component is mounted. It sets the initial height for the accordion's content wrapper based on the size of the content element. It also includes ResizeObserver
.
- ResizeObserver:
A built-in tool for observing changes in the size of the accordion's content element. If the content changes its size, the accordion automatically adjusts the height of the wrapper for proper display.