Accordion
Use the accordion component to show hidden information based on the collapse and expand state of the child elements using data attribute options
Examples
Accordion
A basic accordion function.
Code
vue
<template>
<base-accordion>
<base-accordion-item :item-id="1" title="Accordion #1" content="Hello World" />
<base-accordion-item :item-id="2" title="Accordion #2" content="Hello World" />
<base-accordion-item :item-id="3" title="Accordion #3" content="Hello World" />
</base-accordion>
</template>
Always Open
The Collapse component is used to create regions of content that can expand/collapse with a simple animation. It helps to hide content that's not immediately relevant to the user.
Code
vue
<template>
<base-accordion :alwaysOpen="true">
<base-accordion-item :item-id="1" title="Accordion #1" content="Hello World" />
<base-accordion-item :item-id="2" title="Accordion #2" content="Hello World" />
<base-accordion-item :item-id="3" title="Accordion #3" content="Hello World" />
</base-accordion>
</template>
Using Slot
Using slot for rendering accordion item title & content
Code
vue
<template>
<base-accordion>
<base-accordion-item :item-id="1">
<template #title>Accordion #1</template>
<template #default>Hello World</template>
</base-accordion-item>
<base-accordion-item :item-id="2">
<template #title>Accordion #2</template>
<template #default>Hello World</template>
</base-accordion-item>
<base-accordion-item :item-id="3">
<template #title>Accordion #3</template>
<template #default>Hello World</template>
</base-accordion-item>
</base-accordion>
</template>
Accordion API
Props
Name | Type | Default | Description |
---|---|---|---|
alwaysOpen | boolean | false | Disable behavior automatic close another accordion item |
Slot
#default
slot for rendering accordion item
Accordion Item API
Props
Name | Type | Default | Description |
---|---|---|---|
item-id | string | Accordion item identifier is required and should be unique . It used for calculate height each item and manage active state | |
title | string | Accordion item title. | |
content | string | Accordion item content. |
Slot
#default
slot for rendering accordion item content
#title
slot for rendering accordion item title