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

silc-accordion

v0.10.2

Published

Accordion component for the silc framework

Downloads

13

Readme

silc Accordion Build Status npm version

The accordion module is an ultra-lightweight web component for the silc framework. The accordion module is capable of pure accordions, accordions that become tabs, or pure tabs.

HTML

<div class="silc-accordion" id="accordion-0">
    <div class="silc-accordion__section">
         <button id="accordion-0-section-1-label" class="silc-accordion__label" aria-controls="accordion-0-section-1-content">
             Accordion 1
         </button>
         <div class="silc-accordion__content" id="accordion-0-section-1-content"  aria-labelledby="accordion-0-section-1-label">
             <div class="silc-accordion__content-compartment">
                 <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quod perferendis architecto deserunt, et libero culpa obcaecati ab possimus laborum quibusdam, eum harum accusamus. Quisquam, facere suscipit hic maiores voluptatibus perspiciatis?</p>
             </div>
         </div>
    </div>
    <div class="silc-accordion__section">
        <button id="accordion-0-section-2-label" class="silc-accordion__label" aria-controls="accordion-0-section-2-content">
            Accordion 2
        </button>
        <div class="silc-accordion__content" id="accordion-0-section-2-content"  aria-labelledby="accordion-0-section-2-label">
            <div class="silc-accordion__content-compartment">
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum, id inventore! Labore vel, mollitia quae cum quibusdam, dolore harum doloribus dicta adipisci iusto eligendi consectetur nam, impedit quia atque in.</p>
            </div>
        </div>
    </div>
</div>

Accordion that becomes tabs

<div class="silc-accordion silc-accordion--become-tabs" id="accordion-1" data-silc-accordion-animated>
    <div class="silc-accordion__section">
        <button id="accordion-1-section-1-label" class="silc-accordion__label" aria-controls="accordion-1-section-1-content">
            Tab 1
        </button>
        <div class="silc-accordion__content" id="accordion-1-section-1-content" aria-labelledby="accordion-1-section-1-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 1 content</p>
            </div>
        </div>
    </div>
    <div class="silc-accordion__section">
        <button id="accordion-1-section-2-label" class="silc-accordion__label" aria-controls="accordion-1-section-2-content">
            Tab 2
        </button>
        <div class="silc-accordion__content" id="accordion-1-section-2-content" aria-labelledby="accordion-1-section-2-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 2 content</p>
            </div>
        </div>
    </div>
    <div class="silc-accordion__section">
        <button id="accordion-1-section-3-label" class="silc-accordion__label" aria-controls="accordion-1-section-3-content">
            Tab 3
        </button>
        <div class="silc-accordion__content" id="accordion-1-section-3-content" aria-labelledby="accordion-1-section-3-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 3 Content</p>
            </div>
        </div>
    </div>
</div>

Tabs

<div class="silc-accordion silc-accordion--tabs" id="accordion-2">
    <div class="silc-accordion__section">
        <button id="accordion-2-section-1-label" class="silc-accordion__label" aria-controls="accordion-2-section-1-content">
            Tab 1
        </button>
        <div class="silc-accordion__content" id="accordion-2-section-1-content" aria-labelledby="accordion-2-section-1-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 1 Content</p>
            </div>
        </div>
    </div>
    <div class="silc-accordion__section">
        <button id="accordion-2-section-2-label" class="silc-accordion__label" aria-controls="accordion-2-section-2-content">
            Tab 2
        </button>
        <div class="silc-accordion__content" id="accordion-2-section-2-content" aria-labelledby="accordion-2-section-2-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 2 Content</p>
            </div>
        </div>
    </div>
    <div class="silc-accordion__section">
        <button id="accordion-2-section-3-label" class="silc-accordion__label" aria-controls="accordion-2-section-3-content">
            Tab 3
        </button>
        <div class="silc-accordion__content" id="accordion-2-section-3-content" aria-labelledby="accordion-2-section-3-label">
            <div class="silc-accordion__content-compartment">
                <p>Tab 3 Content</p>
            </div>
        </div>
    </div>
</div>

Class modifiers

Tabs navigation width

Tabs can be set to "stretch" to the entire length of the tabs container by adding the modifier silc-accordion--stretch-tabs

<div class="silc-accordion silc-accordion--tabs silc-accordion--stretch-tabs">
...
</div>

Options

The functionality of the accordion can be modified by adding JavaScript data attributes.

  • Open first accordion by default: data-silc-accordion-open-first
  • Allow multiple content areas to be open: data-silc-accordion-open-multiple
  • Allow slide animations for accordions: data-silc-accordion-animated

Styling

As with all silc components, no deliberate style has been added. However, through a SASS fallback system, a number of SASS variables are available to easily apply design without having to write your own selectors.