Skip to content

Proper support for the HTML5 <details> tag in Vue 2 including v-model attribute (<1KB)

License

Notifications You must be signed in to change notification settings

kim366/vue-details

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version

Vue Details for Vue 2

Proper support for <details> tag in Vue.js including v-model attribute.

Get Started

Using Node.js

Install package

npm install vue-details

Initialize globally

import Vue from 'vue';
import VueDetails from 'vue-details';

Vue.component('v-details', VueDetails);

or locally as shown in the example below.

Using CDN

Load script

<script src="https://cdn.jsdelivr.net/npm/vue-details"></script>

or

<script src="https://unpkg.com/vue-details/dist/vue-details.min.js"></script>

Register component

Vue.component('v-details', VueDetails);

An Example

Try it Online

Code in a .vue File

<template>
  <v-details v-model="open">
    <summary>
      Content is {{ open ? 'shown' : 'hidden' }}
    </summary>
    <p>
      Expandable content
    </p>
  </v-details>
</template>

<script>
import VueDetails from 'vue-details';

export default {
  data() {
    return {
      open: true
    }
  },
  components: { 'v-details': VueDetails }
}
</script>

About

Proper support for the HTML5 <details> tag in Vue 2 including v-model attribute (<1KB)

Resources

License

Stars

Watchers

Forks

Packages

No packages published