← All Components
<mth-accordion>
Vertically stacked disclosure group coordinating <mth-accordion-item> expansion via SelectionController, SlotCollectionController, and RovingFocusController.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-accordion>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/accordion"></script>
<mth-accordion collapsible>Example</mth-accordion>import '@methane-ui/ui/accordion';
import '@methane-ui/react';
export function Example() {
return <mth-accordion collapsible>Example</mth-accordion>;
}<script setup lang="ts">
import '@methane-ui/ui/accordion';
</script>
<template>
<mth-accordion collapsible>Example</mth-accordion>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/accordion';
import { MthAccordionDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthAccordionDirective],
template: `<mth-accordion collapsible>Example</mth-accordion>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/accordion';
import MthAccordion from '@methane-ui/svelte/MthAccordion.svelte';
</script>
<MthAccordion collapsible>Example</MthAccordion>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
multiple | multiple | boolean | false | Allows multiple accordion items to be expanded simultaneously. |
collapsible | collapsible | boolean | true | Allows collapsing all items (when false, at least one item stays expanded). |
value | value | string | "" | Currently expanded item value (comma-separated when multiple is true). |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { value: string } | Fired when expanded item selection changes via user interaction. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | focus is on an item trigger | moves focus to next enabled item trigger |
| ArrowUp | both | focus is on an item trigger | moves focus to previous enabled item trigger |
| Home | both | focus is on an item trigger | moves focus to first enabled item trigger |
| End | both | focus is on an item trigger | moves focus to last enabled item trigger |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 4 APG keyboard transitions across LTR/RTL. | mth-accordion.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(multiple). | Conformance suite |