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

@substrate-system/button

v0.0.31

Published

A button component with a visual "loading" state

Readme

button

tests types module dependencies install size gzip size semantic versioning Common Changelog license

A button web component, with a visual "loading" state.

See a live demo

Demo of the button

Install

npm i -S @substrate-system/button

Dependencies

Depends on these CSS variables, which are exposed in the @substrate-system/css package.

:root {
  --substrate-medium: #999da0;
  --substrate-button-text: #36393d;
  --substrate-primary: #36393d;
  --substrate-font: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  --substrate-button-background: #f5f5f5;
  --substrate-button-shadow: #00000054;
  --substrate-button-background-focus: #ededed;
  --substrate-button-background-hover: #e6e6e6;
}

API

This exposes ESM and common JS via package.json exports field.

ESM

import { SubstrateButton } from '@substrate-system/button'

Common JS

const { SubstrateButton } = require('@substrate-system/button')

CSS

Bundler

Import CSS with a bundler, like esbuild.

import '@substrate-system/button/css'

Or minified:

import '@substrate-system/button/css/min'

CSS import

Or use CSS imports:

@import url("../node_modules/@substrate-system/button/dist/index.min.css");

Use

You can set a name for this custom element with the static method define. To use the default name, substrate-button, just import and call .define().

[!CAUTION]
If you change the name of the web component, it will break the CSS.

To use the default, call .define():

import { SubstrateButton } from '@substrate-system/button'
import '@substrate-system/button/css'

// create a web component named `substrate-button`
SubstrateButton.define()

Or override the tag property to change the tag name:

import { SubstrateButton } from '@substrate-system/button'

// set a custom name
SubstrateButton.tag = 'cool-button'

SubstrateButton.define()

Module format

This package includes ESM, Common JS, and pre-bundled versions.

Bundler

Just import like normal.

Full

This is a web component that knows how to render itself.

import { SubstrateButton } from '@substrate-system/button'

SubstrateButton.define()

Client

The client version should be used in conjunction with server-side rendering. It does not know how to render itself.

import { SubstrateButton } from '@substrate-system/button/client'

SubstrateButton.define()

Server-side

Take some attributes, and return a string of HTML.

import { html } from '@substrate-system/button/html'

const htmlString = html({
  classes: ['abc'],
  disabled: false,
  autofocus: false
})

pre-built

This package exposes minified JS and CSS files. Copy them to a location that is accessible to your web server, then link to them in HTML.

copy

cp ./node_modules/@substrate-system/button/dist/index.min.js ./public/substrate-button.min.js
cp ./node_modules/@substrate-system/button/dist/index.min.css ./public/substrate-button.css

HTML

<head>
    <link rel="stylesheet" href="./substrate-button.css">
</head>
<body>
    <!-- ... -->
    <script type="module" src="./substrate-button.min.js"></script>
</body>

Example

See the example in ./example.

Attributes

spinning

Add an attribute spinning to set the loading state.

const el = document.querySelector('substrate-button')
el?.setAttribute('spinning', '')
// now it shows a spinning animation

Remove the attribute to stop the animation:

const el = document.querySelector('substrate-button')
el?.removeAttribute('spinning')

JS API

Or, if you have a reference to the element, you can set the spinning property for the same effect:

const el = document.querySelector('substrate-button')

el.spinning = true  // spin

el.spinning = false  // stop