Skip to content

Accordions group - AvAccordionsGroup ​

✨ Introduction ​

The AvAccordionsGroup component automatically manages the addition of AvAccordion in a group according to the AvAccordion present in the default slot.

Accordions allow users to show and hide sections of content presented on a page.

The accordions group lets you group several accordions into a single coherent unit. It manages active selection logic between child accordions, allowing you to open one accordion while closing the others. This component is essential for organizing interactively linked accordion sets.

🏗️ Structure ​

None.

🏷️ Props ​

NameTypeDefaultMandatoryDescription
activeAccordionnumberundefinedIndex of the currently active accordion. Used with v-model:activeAccordion for two-way data binding.

🔊 Events ​

NameDescription
update:activeAccordionEmitted when the active accordion changes. Receives the index of the newly active accordion.

🎨 Slots ​

NameDescription
defaultDefault slot for adding accordions (each accordion must be in an AvAccordion).

🚀 Storybook demos ​

You can find examples of use and demo of the component on its dedicated Storybook page.

💡 Examples of use ​

Basic usage ​

vue
<template>
  <AvAccordionsGroup>
    <AvAccordion
      title="Accordion 1"
      icon="mdi:file-document-multiple-outline"
    >
      <span>First accordion content</span>
    </AvAccordion>
    <AvAccordion
      title="Accordion 2"
      icon="mdi:plus-circle-outline"
    >
      <span>Second accordion content</span>
    </AvAccordion>
  </AvAccordionsGroup>
</template>

With controlled state ​

vue
<script setup lang="ts">
const activeAccordion = ref(0)
</script>

<template>
  <AvAccordionsGroup v-model:active-accordion="activeAccordion">
    <AvAccordion
      title="Accordion 1"
      icon="mdi:file-document-multiple-outline"
    >
      <span>First accordion content</span>
    </AvAccordion>
    <AvAccordion
      title="Accordion 2"
      icon="mdi:plus-circle-outline"
    >
      <span>Second accordion content</span>
    </AvAccordion>
  </AvAccordionsGroup>
</template>