Accordion

Collapsible panels for organizing content into expandable sections. By default, only one panel can be open at a time (true accordion behavior). Supports animated carets, multiple open panels, and compact/borderless variants. Fully keyboard-navigable with ARIA roles.

Basic Accordion (Single Open)

By default, opening a panel automatically closes any other open panels. Default: first panel open.

Configure general application settings here.

PHP

Allow Multiple Panels Open

Use ->allowMultiple() to allow multiple panels to be open simultaneously.

PHP

Non-Animated

Omit ->animated() for instant expand/collapse with a static caret icon. Default: non-animated.

  • Founded: 2024
  • Headquarters: Wellington
  • Employees: 50+
PHP

Compact Style

Use ->addClass('m-accordion--compact') for smaller padding on headers and content.

Borderless Style

Use ->addClass('m-accordion--borderless') to remove borders between panels.

PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->accordion($id)stringCreate an accordion component.
->panel($title, $content, ?$icon)string, string, ?stringAdd a panel with title, HTML content, and optional icon. Returns self for chaining.
->animated()Enable animated caret rotation and smooth height transitions. Default: false.
->allowMultiple()Allow multiple panels to be open simultaneously. Default: false (only one panel open).
->defaultOpen($index)intSet which panel is open by default (0-based index). Default: none open.
->addClass($class)stringAdd CSS classes. Use m-accordion--compact or m-accordion--borderless for variants.
->attr($name, $value)string, stringAdd custom HTML attributes to the accordion container.

JS JS Methods

Method / PropertyParametersDescription
m.accordion(id)stringGet the accordion API for the given element ID.
open(index)intOpen a panel by index (0-based). If allowMultiple is false, closes other panels.
close(index)intClose a panel by index (0-based).
toggle(index)intToggle a panel's open/closed state.
getOpen()Returns an array of currently open panel indices.

EVENT Events

Event NameDetailDescription
m:accordion:opened{index, panel, header, content}Fired when a panel is opened. index is the 0-based panel index.
m:accordion:closed{index, panel, header, content}Fired when a panel is closed. index is the 0-based panel index.