Skip to content

Accordion

The EAccordion component is a useful tool for managing and displaying large amounts of data on a webpage. Demo Here

It enables users to hide and display sections of content at a time. Nevertheless, when a multiple prop is used, multiple items can expand until explicitly closed.

Usage

The EAccordion and EAccordionGroup components are used together as below:

vue

<template>
  <EAccordionGroup v-model="activeAccordion">
    <EAccordion>
      <template #title>Title</template>
      <template #content>This an Accordion item</template>
    </EAccordion>
  </EAccordionGroup>
</template>

<script setup>
  const activeAccordion = ref([]);
</script>

The type of v-model is Array and it needs to be assigned like this: v-model="your_active_item_index_inside_Array_variable".

Props

For EAccordionGroup component, the following props are available:

PropTypeDefaultNote
modelValue[Number, Array]falseAccordion's active prop
multipleBooleanfalseThe multiple property allows more than one item to expand at the same time.
disabledBooleanfalseDisables the the accordion elements.
variantString"fill"The EAccordion elements can be represented in two ways: fill and outline.
colorString"dark_theme-100"The given color is applied to the element - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
squareBooleanfalseRemoves rounded corners of the element.

For EAccordion component, the following props are available:

PropTypeDefaultNote
variantString"fill"The EAccordion elements can be represented in two ways: fill and outline.
prependIconObject{}Inserts a custom EIcon element to the accordion item(s) that is located before the title. here.
appendIconObject{}Inserts a custom EIcon element to the accordion item(s) that is located after the title. here.
disabledBooleanfalseDisables the EAccordion element.
colorString"dark_theme-100"The given color is applied to the element - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
squareBooleanfalseRemoves rounded corners of the element.
disabledBooleanfalseDisables the the accordion elements.

Note

As you can see, the EAccordionGroup and EAccordion components share a few properties (disabled, color, etc.) which can be used in two ways:

vue

<template>
  <EAccordionGroup color="danger">
    <EAccordion>
      <!-- color: danger -->
      <template #title>Title</template>
      <template #content>Content 1</template>
    </EAccordion>
    <EAccordion>
      <!-- color: danger -->
      <template #title>Title</template>
      <template #content>Content 2</template>
    </EAccordion>
  </EAccordionGroup>
</template>
vue

<template>
  <EAccordionGroup color="danger">
    <EAccordion color="success">
      <!-- color: success -->
      <template #title>Title</template>
      <template #content>Content 1</template>
    </EAccordion>
    <EAccordion>
      <!-- color: danger -->
      <template #title>Title</template>
      <template #content>Content 2</template>
    </EAccordion>
  </EAccordionGroup>
</template>

Emits

The EAccordionGroup component contains following emits.

EmitDescription
update:modelValueEmitted when the local ref's value is mutated.

The EAccordion component contains following emits.

EmitDescription
update:modelValueEmitted when the local ref's value is mutated.

Slots

The EAccordion component provides the following slots that enable you to customize the content.

SlotDescription
contentSlot for the component’s text content.
titleSlot for the component’s title content.

COPYRIGHT