Lapikit

One action to manage accordion state

UseAccordion

The useAccordion action provides an easy way to manage the state of an accordion component in your Svelte application. It allows you to control which sections of the accordion are expanded or collapsed, enhancing the user experience by organizing content in a compact and accessible manner.

You can use this action by attaching it to your accordion component and passing the necessary parameters. The action will handle the toggling of sections based on user interaction.

Parameters

parametertypedefaultdescription
multiplebooleanfalseAllow multiple sections to be open
readOnlybooleanfalseMake the accordion non-interactive (read-only)

Return

parametertypedescription
values(string \| number)[]Array of opened section identifiers
toggle(id: string \| number) => voidFunction to open/close a section

Do you have a question? Ask on GitHub or Discord server

Do you see a bug? Open an issue on GitHub