Coder Social home page Coder Social logo

glennflanagan / vue-collapsible Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 4.0 1.61 MB

Vue component to wrap content in Collapsible element with trigger to open and close.

Home Page: https://vue-collapsible.netlify.com/

License: MIT License

JavaScript 4.47% HTML 4.86% Vue 90.67%
collapsible vue vuejs accordion

vue-collapsible's Introduction

Netlify Status Npm Version License Downloads Per Week

Vue Responsive Collapsible Section Component (Collapsible)

Vue component to wrap content in Collapsible element with trigger to open and close.

Alt text

It's like an accordion, but where any number of sections can be open at the same time.

See the demo source code for code examples of how to use.

Installation

Install via npm

npm install vue-collapsible-component

or yarn

yarn add vue-collapsible-component

Alternatively just download the Collapsible.vue file form the src folder and include it in your project in your chosen way.

Usage

Collapsible can receive any HTML elements or Vue component as it's children. Collapsible will wrap the contents, as well as generate a trigger element which will control showing and hiding.

To customise the trigger element use the trigger slot for the open state, and closedTrigger slot for the closed state.

<template>
  <Collapsible class="example-collapsible">
    <div slot="trigger">
      <div class="customTrigger">
        <h2>Custom open trigger element</h2>
      </div>
    </div>

    <div slot="closedTrigger">
      <div class="customTrigger">
        <h2>Custom closed trigger element</h2>
      </div>
    </div>

    <div id="example2">
      <p>
        Lorem ipsum dolor sit ...
      </p>
    </div>
  </Collapsible>
</template>

<script>
  import 'vue-collapsible-component/lib/vue-collapsible.css';
  import Collapsible from 'vue-collapsible-component';

  export default {
    components: {
      Collapsible,
    },
  };
</script>

Props

These are the available overrides


openLabel <String>

Set the default trigger open label


closedLabel <String>

Set the default trigger close label


transitionDuration <String>

Override the default CSS transition duration. Example 500ms


transitionTimingFunction <String>

Override the default CSS transition timing function. Example ease-in-out


transitionDelay <String>

Override the default CSS transition delay. Example 300ms


isOpen <Boolean>

Sets the default open/closed state. Use this to control the open/close state programmatically.


onCollapse <Function>

Fired whenever the open/close state is changed with the new open/closed state.


Licence

MIT

Contributing

View the the README

vue-collapsible's People

Contributors

dependabot[bot] avatar glennflanagan avatar iatanas0v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-collapsible's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.