npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

@stereorepo/accordion

v3.2.5

Published

[Alban πŸ”₯] _Accordion_ is the **supreme**, **most modern** and **sexy** accordion package ever made πŸ’…

Downloads

214

Readme

Accordion πŸ”½

[Alban πŸ”₯] Accordion is the supreme, most modern and sexy accordion package ever made πŸ’…

Installation

npm i -S @stereorepo/accordion

Usage

The easiest, most effective way to build an accordion is to use four html elements.

First: the container

Second: the clickable element

Third: the content wrapper

Fourth: the accordion content container

How it works on paper

The container will... contain (πŸ‘) all the elements you'll need to create magic.

The clickable element (frequently your accordion title) will allow us to reveal the accordion content when clicked.

Its first and only bro : the content wrapper.

The content wrapper will be the expanding/contracting element. We will change its max-height css property to reveal/hide the accordion content.

We need a content container to know the height of our actual content.

The html

<!-- ... -->
<div class="my-accordion js-accordion">
    <p class="js-accordion-title">My title</p>
    <div class="ph-content-wrapper js-accordion-content-wrapper">
        <div class="js-accordion-content">
            <!-- Inside put your content -->
        </div>
    </div>
</div>
<!-- ... -->

Example

// You can import the vanilla Accordion
import { Accordion } from '@stereosuper/accordion';
// or the Vue.js version of it
import { AccordionVue } from '@stereosuper/accordion';

// then instanciate it
const accordions = new Accordion({
    containerSelector: '.js-accordion',
    clickedSelector: '.js-accordion-title',
    contentWrapperSelector: '.js-accordion-content-wrapper',
    contentSelector: '.js-accordion-content',
    offsetY: 100,
    scrollDelay: 200,
    noScroll: false,
    silent: true
});

// and finally watch the magic happen
accordions.initializeAccordions();

initializeAccordions

containerSelector, clickedSelector, contentWrapperSelector, and contentSelector are the four main elements composing our accordion (see πŸ‘† there).

offsetY

This is the amount of pixels of the margin you want between the top of your window and the top of your accordion... because, yeah, by default it automatically scrolls to the top of the clicked accordion 😏

scrollDelay

Seriously... just read the fuc**** title

noScroll

You can deactivate the scroll with you want... much less SWAG, but still cool.

silent

You can deactivate the console's errors if you want (for example if you don't use bodyRouter)

The scss placeholder

To easily add the css properties you need for the accordions to work you can use the %stereorepo-accordion scss placeholder.

@import '~@stereorepo/accordion/src/accordion';

// It will search for the any .ph-content-wrapper class inside your accordion and add to this element only the properties needed
.my-accordion {
    @extend %stereorepo-accordion;
}