# Accordion (@limerdev/zest) Sections that open and close under their headings: `` (`type="single"` or `"multiple"`, `bind:value`) holds `Accordion.Item`s (`value`), each with an `Accordion.Trigger` (its heading, `level` 3 by default) and an `Accordion.Content`. Enter or Space toggles a section; arrow keys move between headings. - Category: Data display - Import: `import { Accordion } from '@limerdev/zest'` - Bits UI: `Accordion`, https://bits-ui.com/docs/components/accordion - Exports: `Accordion.Root`, `Accordion.Item`, `Accordion.Trigger`, `Accordion.Content` - Use for: Long content people scan by heading and open as needed: FAQs, a settings page with many groups, details under a summary. - Don't: Content everyone needs, or that is short enough to show: don't hide it. Switching between views of the same thing: use `Tabs`. A single open/close section: use `Collapsible`. ```svelte How is time billed? Per started half hour, from approved weeks. ``` Props of `Accordion.Root`: - `disabled` (`boolean`, default `false`): Whether the accordion is disabled or not. - `loop` (`boolean`, default `true`): Whether to loop through the accordion items when navigating with the arrow keys. - `onValueChange` (`OnChangeFn | OnChangeFn`): A callback function called when the value changes. - `orientation` (`"horizontal" | "vertical"`, default `"vertical"`): The orientation of the accordion. - `type` (`"multiple" | "single"`, required): The type of accordion. If set to `'multiple'`, the accordion will allow multiple items to be open at the same time. If set to `'single'`, the accordion will only allow a single item to be open. - `value` (`string | string[]`, default `""`, bindable): The value of the currently open accordion item. Props of `Accordion.Item`: - `disabled` (`boolean`, default `false`): Whether the accordion item is disabled, which prevents users from interacting with it. - `value` (`string`): The value of the accordion item. This is used to identify if the item is open or closed. If not provided, a unique ID will be generated for this value. Props of `Accordion.Trigger`: - `level` (`1 | 2 | 3 | 4 | 5 | 6`, default `3`): The heading level the trigger sits in, to fit the page's outline. Props of `Accordion.Content`: - `forceMount` (`boolean`, default `true`): Whether to forcefully mount the content, regardless of the open state. This is useful if you want to use Svelte transitions for the content. - `hiddenUntilFound` (`boolean`, default `false`): Whether to allow the browser to expand the content when searching for content within the panel via the browser's built-in search functionality. When `true`, this prop will override the `forceMount` prop. Example: Faq type="single" keeps one section open; collapsible lets it close again. ```svelte {#each questions as item (item.value)} {item.question} {item.answer} {/each} ```