Accordion
A stack of collapsible sections; one or several can be open.
import { Accordion, AccordionItem } from '@elluzion/iv-ui'; 01 Preview
Single
Opening one section closes the previous one.
Node 22 on Linux, with the edge cache in front of every request.
Source· svelte Show Hide
<script lang="ts">
import { Accordion, AccordionItem } from '@elluzion/iv-ui';
</script>
<Accordion defaultValue="runtime">
<AccordionItem value="runtime" title="Runtime">
<p>Node 22 on Linux, with the edge cache in front of every request.</p>
</AccordionItem>
<AccordionItem value="build" title="Build">
<p>Static output is prerendered; the rest is bundled on demand.</p>
</AccordionItem>
<AccordionItem value="regions" title="Regions">
<p>Three regions, one primary and two read replicas.</p>
</AccordionItem>
</Accordion>02 Usage
- Each
AccordionItemneeds a uniquevalue; the parent tracks the open values. - Set
multipleto keep several panels open at once. - Bind
valuefor controlled state, or usedefaultValuefor an uncontrolled accordion.
03 Examples
Multiple
multiple keeps every opened section open.
Node 22 on Linux, with the edge cache in front of every request.
Three regions, one primary and two read replicas.
Source· svelte Show Hide
<script lang="ts">
import { Accordion, AccordionItem } from '@elluzion/iv-ui';
</script>
<Accordion multiple defaultValue={['runtime', 'regions']}>
<AccordionItem value="runtime" title="Runtime">
<p>Node 22 on Linux, with the edge cache in front of every request.</p>
</AccordionItem>
<AccordionItem value="build" title="Build">
<p>Static output is prerendered; the rest is bundled on demand.</p>
</AccordionItem>
<AccordionItem value="regions" title="Regions">
<p>Three regions, one primary and two read replicas.</p>
</AccordionItem>
</Accordion>Custom trigger
The trigger snippet replaces the title content.
Roles are inherited from the organization; overrides live on the project.
Source· svelte Show Hide
<script lang="ts">
import { IconShieldLock } from '@tabler/icons-svelte';
import { Accordion, AccordionItem } from '@elluzion/iv-ui';
</script>
<Accordion defaultValue="access">
<AccordionItem value="access">
{#snippet trigger()}
<span class="trigger">
<IconShieldLock size={14} />
Access control
</span>
{/snippet}
<p>Roles are inherited from the organization; overrides live on the project.</p>
</AccordionItem>
<AccordionItem value="audit" title="Audit log">
<p>Every privileged action is recorded with the actor and the request id.</p>
</AccordionItem>
</Accordion>
<style>
.trigger {
display: inline-flex;
align-items: center;
gap: var(--iv_spacing-sm);
}
</style>04 API
import { Accordion, AccordionItem } from '@elluzion/iv-ui';Accordion
5 props · 1 events · 1 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| multiple | boolean | false | Allows several items to stay open at once. |
| value bindable | AccordionValue | — | Open item value(s). Bind with bind:value for controlled state. |
| defaultValue | AccordionValue | — | Item(s) open on first render. |
| disabled | boolean | false | Disables interaction and applies the disabled treatment. |
| className | string | '' | Extra classes merged onto the root element. |
class, id, style, aria-*, and data-* are forwarded through rest props.
Events
| Event | Handler type | Description |
|---|---|---|
| onchange | (e: CustomEvent<{ value: AccordionValue }>) => void | Called with { value } after an item opens or closes. |
The legacy on:name form is accepted for every event.
Snippets
| Snippet | Type | Description |
|---|---|---|
| children | Snippet | Content rendered inside the component. |
Types
AccordionValue
One open item, or several when multiple is set.
type AccordionValue = string | string[];AccordionItem
3 props · 0 events · 2 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| value required | string | — | Unique value used by the parent accordion to track this item. |
| title | string | '' | Trigger text. Use the trigger snippet for custom content. |
| disabled | boolean | false | Disables interaction and applies the disabled treatment. |
Snippets
| Snippet | Type | Description |
|---|---|---|
| children | Snippet | Panel content revealed when the item is open. |
| trigger | Snippet | Custom trigger content replacing the title. |
05 Accessibility
| Keys | Action |
|---|---|
| Tab | Moves focus to the next trigger. |
| Enter / Space | Opens or closes the focused section. |
- Triggers are native buttons with
aria-expandedandaria-controls. - Panels use
role="region"and are labelled by their trigger. - Opening and closing respects
prefers-reduced-motion.
06 Tokens & CSS hooks
Tokens used
Class hooks
.iv-accordion.iv-disabled.iv-chevron.iv-item.iv-open.iv-panel.iv-trigger.iv-trigger-label