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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gk-wc-button

v0.7.0

Published

Web component button

Readme

gk_wc_button

Installation

  1. 'npm install' and add tag that points to the packages index.js file located within the node_modules folder.
  2. Call 'loadComponent' and pass in file path to the packages 'button.wc' file located within the node_modules folder.

<script src="../index.js"></script>
<script>
    loadComponent('../button.wc')
</script>

Usage

Loading

To trigger the loading animation, the 'loading' attribute needs to be set on the button. This can be done with a bit of javascript.

<gk-wc-button id="gkButton">
</gk-wc-button>

<script>
    const EL = document.querySelector('#gkButton')
    EL.addEventListener('click', function () {
        EL.setAttribute('loading', true)
        
        // Wait for something to happen...        
        EL.setAttribute('loading', false)
    })
</script>

Rounded

To add rounding to the corners of the button, add the 'rounded' attribute.

<gk-wc-button rounded>
</gk-wc-button>

Colour

To change the colour of the button, add the colour attibute with a valid param. Currently, only the following values are valid; negative, warning, success and base.

If you would like to replace these colours, then you can do so by creating your own custom css variables in HSL format, rather than the usual HEX which most people will be used to.

The below code snippet is #ffd500 formatted as hsl. --component-colour-base refers to the hue and saturation of HSL, and --component-colour-base-lightness refers to...the lightness of HSL. In raw css, #ffd500 would be represented as hsl(50, 100%, 50%).

gk-wc-button {
    --component-colour-base: 50, 100%;
    --component-colour-base-lightness: 50;

    --component-colour-warning: 0, 100%;
    --component-colour-warning-lightness: 50;
}
<gk-wc-button colour="success">
</gk-wc-button>

Icon

To change the icon, create a slot and insert your desired image.

<gk-wc-button>
    <div slot="icon">
        <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="database" class="svg-inline--fa fa-database fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z"></path></svg>
    </div>
</gk-wc-button>

Outline

To create a flat design that just has a outline border, add the 'outline' attribute.

<gk-wc-button outline>
</gk-wc-button>

Example:

<gk-wc-button
    id="gkButton"
    rounded
    colour="neutral"
>
</gk-wc-button>