Accordion
Collapsible content sections, single or multiple mode
Run bun add @dryui/ui, then import @dryui/ui/themes/default.css and @dryui/ui/themes/dark.css in your root layout. Add class="theme-auto" to the <html> element so components pick up
the user's system preference.
Accessibility
- Use descriptive trigger text so the hidden content is understandable before expansion.
- Keep each trigger paired with its matching content so keyboard and screen-reader relationships stay intact.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Accordion } from '@dryui/ui';
</script>
<Accordion.Root>
<Accordion.Item value="a">
<Accordion.Trigger>Section A</Accordion.Trigger>
<Accordion.Content>Content for section A.</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="b">
<Accordion.Trigger>Section B</Accordion.Trigger>
<Accordion.Content>Content for section B.</Accordion.Content>
</Accordion.Item>
</Accordion.Root> Import options
Root package
ts
import { Accordion } from '@dryui/ui' Per-component subpath
ts
import { Accordion } from '@dryui/ui/accordion' API
Props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Description | Default | Required | Bindable |
|---|---|---|---|---|---|
Accordion.Root | |||||
| type | singlemultiple | Accordion behavior mode for single or multiple expanded items. | 'single' | — | — |
| value | string[] | Current controlled or bindable value. | [] | — | — |
| orientation | horizontalvertical | Horizontal or vertical layout direction. | 'vertical' | — | — |
| children | Snippet | Content rendered inside the component. | — | ✓ | — |
Accordion.Item | |||||
| value | string | Current controlled or bindable value. | — | ✓ | — |
| disabled | boolean | Prevents interaction and applies disabled styling. | false | — | — |
| children | Snippet | Content rendered inside the component. | — | ✓ | — |
Accordion.Trigger | |||||
| children | Snippet | Content rendered inside the component. | — | ✓ | — |
Accordion.Content | |||||
| children | Snippet | Content rendered inside the component. | — | ✓ | — |