Accordion API

This page provides an overview of the Accordion component API, detailing its props, emits, slots, and exposed methods/states.

Props

The Accordion component accepts the following props:

PropDefaultTypeDescription
dataSource[]Array<AccordionItem> or undefinedThe list of sections to display in the accordion. Each item should be an Array<AccordionItem>.
multiplefalseboolean or undefinedAllows multiple sections to be open at the same time.
animationDuration300number or undefinedThe duration of the open/close animation in milliseconds.
icon"Plus""ChevronDown" or "ArrowDownCircle" or "Plus" or
undefined
The type of icon displayed to indicate the toggle state of the accordion.
class""StyleClass or undefinedCustom CSS class for the root accordion container.
classItem""StyleClass or undefinedCustom CSS class for individual accordion items.
classTitle""StyleClass or undefinedCustom CSS class for the title of each accordion item.
classSubtitle""StyleClass or undefinedCustom CSS class for the subtitle of each accordion item.

AccordionItem

Each item in the dataSource array should follow the AccordionItem structure:

FieldTypeDescription
titlestringThe main title of the accordion section.
subtitlestring or undefinedOptional subtitle or content for the section.
openboolean or undefinedIndicates whether the section is initially open.
templatestring or undefinedOptional slot name for custom content inside the section.
[key: string]anyAny additional properties to include in the item.

Slots

The Accordion component provides the following slots:

SlotPayloadDescription
title{ title: string }A slot for customizing the title of each accordion item.
Dynamic Slots{ ...AccordionItem }A dynamic slot based on the template field in an Array<AccordionItem>. Allows custom content for specific sections.

Emits

The Accordion component emits the following events:

EventPayloadDescription
toggleArray<AccordionItem>Emitted whenever a section is opened or closed. The payload contains the updated accordion data.

Expose

The Accordion component exposes the following methods and states via ref:

ExposeValueDescription
dataItemsArray<AccordionItem>The current state of the accordion items.
multiplebooleanIndicates whether multiple sections can be open at the same time.
animationDurationnumberThe duration of the open/close animation in milliseconds.
iconstringThe current type of icon used for the accordion toggle.
classBodystringThe CSS class applied to the accordion container.
classItemstringThe CSS class applied to individual accordion items.
classTitlestringThe CSS class applied to the title of each accordion item.
classSubtitlestringThe CSS class applied to the subtitle of each accordion item.
toggle(key: string | number) => voidToggles the state (open/close) of a specific accordion section by key.
© 2025 FishtVue by Egoka