Accordion

A vertically stacked set of interactive headings which reveal or hide their associated content.

Building blocks

import { component$ } from '@builder.io/qwik';
import { Accordion, AccordionItem } from '@qwik-ui/headless';

export default component$(() => (
  <Accordion>
    <AccordionItem>Content</AccordionItem>
  </Accordion>
));

Examples

EXAMPLE: Frequently Asked Questions

Accessibility

Keyboard interaction

Key

Description

Space
Expand or collapse the `AccordionItem`.
Enter
Expand or collapse the `AccordionItem`.
Tab
Moves focus to the next focusable element.
Shift + Tab
Moves focus to the previous focusable element.
Home
When on `AccordionItem`, Moves focus to the first `AccordionItem`.
End
When on `AccordionItem`, Moves focus to the last `AccordionItem`.

API

AccordionItem

PropTypeDescription
classstring

CSS classes to apply to the accordion container.

stylestring

CSS styles to apply to the accordion container.

labelstring

The label to give to the accordion item.

onClick$PropFunction<() => void>

A custom click handler