A Simple Accordion Component Plugin for Vue 3

A Simple Accordion Component Plugin for Vue 3

Vue3 Accessible Accordion A simple accordion component plugin for Vue 3. Follows the Accordion Design Pattern in WAI-ARIA Authoring Practices 1.1 for accessibility best practices automatically built into the plugin.

Vue3 Accessible Accordion

A simple accordion component plugin for Vue 3. Follows the Accordion Design Pattern in WAI-ARIA Authoring Practices 1.1 for accessibility best practices automatically built into the plugin.

Install

npm i vue3-accessible-accordion

or

yarn add vue3-acccessible-accordion

Register as a Global Component

import { createApp } from 'vue';
import App from './App.vue'
import vue3_accessible_accordion from 'vue3-accessible-accordion';

const app = createApp(App)
            .use(vue3_accessible_accordion);
            .mount('#app')

Register Components Individually

import Accordion, AccordionPanel, AccordionPanelHeader, AccordionPanelContent from 'vue3-accessible-accordion';

export default {
    components: {
        Accordion,
        AccordionPanel,
        AccordionPanelHeader,
        AccordionPanelContent
    }
}

Example Usage

<accordion>
    <accordion-panel>
        <accordion-panel-header>Question 1</accordion-panel-header>
        <accordion-panel-content>Answer to FAQ 1</accordion-panel-content>
    </accordion-panel>

    <accordion-panel>
        <accordion-panel-header>Question 2</accordion-panel-header>
        <accordion-panel-content>Answer to FAQ 2</accordion-panel-content>
    </accordion-panel>
    </accordion-panel>
</accordion>

Components

<accordion>

Props

Prop Type Default Required Description
modelValue Array [] No Array of indexes of active tab panels. Defaults to an empty array - no panels will be open
headerTag String h3 No HTML tag to be used for rendering around the button toggle of each accordion panel header
collapsible Boolean true false Controls whether all accordion panels can be collapsed or if at least one has to be open at all times
expandable Boolean false false Controls whether multiple accordion panels can be open at the same time

Events

None

<accordion-panel>

Props

None

Events

None

<accordion-panel-header>

Props

None

Events

None

<accordion-panel-content>

Props

None

Events

None

Project setup

yarn

Compiles and hot-reloads for development

yarn serve

Compiles and minifies for production

yarn build

Download Details:

Author: jonbackus

Source Code: https://github.com/jonbackus/vue3-accessible-accordion

vue vuejs javascript

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get

How to Make a Simple Vue Custom Select Component

In this article, you’ll learn how to build a Vue custom select component that can be easily be styled using your own CSS. In fact, it’s the same component that we use in production on Qvault, and you can see it in action on the playground.

Creating a Custom Tooltip Component in Vue

There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.

Vue ShortKey plugin for Vue.js

Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.