0.36.0 • Published 4 years ago

@minna-ui/collapse v0.36.0

Weekly downloads
81
License
Apache-2.0
Repository
github
Last release
4 years ago

NPM version NPM bundle size (minified + gzip) Licence

@minna-ui/collapse

A simple component to expand and collapse a section of HTML. It can be used standalone, in Svelte projects, or any JavaScript project.

FIXME: Test if standalone version works correctly.

TODO: Write note about @minna-ui/css interplay/dependency.

TODO: Example image.

TODO: Add link to demo and documentation page.

Usage

Standalone

The easiest way to use the component is to add the CDN hosted version directly in your HTML.

TIP: If you're already using a JavaScript bundler you should follow the the "Other JavaScript projects" instructions.

  1. Add the CSS and JS to your document, inside the <head></head>:

     <link href="https://cdn.jsdelivr.net/npm/@minna-ui/collapse/dist/index.css" rel="stylesheet"/>
    
     <script src="https://cdn.jsdelivr.net/npm/@minna-ui/collapse"></script>

    Or use a specific version:

     <link href="https://cdn.jsdelivr.net/npm/@minna-ui/collapse@0.4.1/dist/index.css" rel="stylesheet"/>
    
     <script src="https://cdn.jsdelivr.net/npm/@minna-ui/collapse@0.4.1"></script>
  2. Add element/s where you want the component to show in your document <body></body>:

     <div class="minna-collapse">
       <p>This is my collapsed content.</p>
     </div>
    
     <div class="minna-collapse">
       <p>This is more collapsed content.</p>
     </div>
  3. Initialise the component/s (this script must come after the HTML code in step 2):

    <script>
      var collapseEls = document.querySelectorAll('.minna-collapse');
      collapseEls.forEach(function(el) {
        new MinnaCollapse({ target: el });
      });
    </script>

Svelte projects

Because this is actually a Svelte component, using it in your Svelte projects is simple and allows for the most flexibility and best possible performance.

  1. Install the package:

    yarn add @minna-ui/collapse
  2. Add to your Svelte component:

    MySvelteComponent.html:

     <MinnaCollapse>
       <p>This is my collapsed content.</p>
     </MinnaCollapse>
    
     <script>
       import MinnaCollapse from '@minna-ui/collapse';
    
       export default {
         components: {
           MinnaCollapse,
         },
       };
     </script>

Other JavaScript projects

This component can also be used alongside any JavaScript project, regardless of your framework of choice, by using ES6 modules import.

  1. Install the package:

    yarn add @minna-ui/collapse
  2. Add to your files:

    my-example.html:

     <div class="minna-collapse">
       <p>This is my collapsed content.</p>
     </div>
    
     <div class="minna-collapse">
       <p>This is more collapsed content.</p>
     </div>

    my-example.js:

    import MinnaCollapse from '@minna-ui/collapse';
    
    const collapseEls = document.querySelectorAll('.minna-collapse');
    collapseEls.forEach((el) => {
      new MinnaCollapse({ target: el });
    });

Licence

@minna-ui/collapse is part of Minna UI, an Apache-2.0 licensed open source project. See LICENCE.


© 2019 We Are Genki

0.36.1-next.57

4 years ago

0.36.0

4 years ago

0.35.2-next.58

4 years ago

0.35.2-next.35

4 years ago

0.35.2-next.26

4 years ago

0.35.2-next.30

4 years ago

0.35.2-next.31

4 years ago

0.36.0-next.24

4 years ago

0.35.0

4 years ago

0.34.0

5 years ago

0.33.2

5 years ago

0.33.1

5 years ago

0.33.0

5 years ago

0.32.0

5 years ago

0.31.3

5 years ago

0.31.0

5 years ago

0.30.0

5 years ago

0.29.0

5 years ago

0.28.0

5 years ago

0.27.0

5 years ago

0.26.0

5 years ago

0.25.0

5 years ago

0.24.0

5 years ago

0.23.0

5 years ago

0.22.2

5 years ago

0.22.1

5 years ago

0.22.1-beta.2

5 years ago

0.22.1-beta.1

5 years ago

0.22.1-beta.0

5 years ago

0.22.0-beta.0

5 years ago

0.22.0-next.23

5 years ago

0.22.0-next.20

5 years ago

0.22.0-next.12

5 years ago

0.22.0-next.332

5 years ago

0.22.0-next.331

5 years ago

0.22.0-next.325

5 years ago

0.22.0-next.307

5 years ago

0.22.0-next.298

5 years ago

0.22.0-next.288

5 years ago

0.22.0-next.274

5 years ago

0.22.0-next.266

5 years ago

0.22.0-next.265

5 years ago

0.22.0-next.262

5 years ago

0.22.0-next.260

5 years ago

0.22.0-next.235

5 years ago

0.22.0-next.228

5 years ago

0.22.0-next.193

5 years ago

0.22.0-next.190

5 years ago

0.22.0-next.77

5 years ago

0.21.0

5 years ago

0.20.0

5 years ago

0.19.0

5 years ago

0.18.0

5 years ago

0.17.0

5 years ago

0.16.0

6 years ago

0.15.2

6 years ago

0.15.1

6 years ago

0.15.0

6 years ago

0.13.0

6 years ago

0.12.0

6 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago