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

@uiball/loaders

v1.3.1

Published

Tree-shakeable CSS and SVG loaders for React

Downloads

80,285

Readme

🛑 Deprecated

This package has been superceded by the new LDRS project:

Website: https://uiball.com/ldrs
GitHub: https://github.com/GriffinJohnston/ldrs
NPM: https://www.npmjs.com/package/ldrs

LDRS exports HTML custom elements instead of React components, which means it will work with any library or framework, including React. Because of this and other breaking changes (one or two loaders are renamed), LDRS is not a drop-in replacement for @uiball/loaders. It's still easy to use though, and way more flexible.

Loaders

Lightweight loaders & spinners for your next React project.

  • 24 Types 🎨 — Unique enough to be interesting; simple enough to use in real-world projects
  • Customizable 🖌️ — Set the size, color, line weight and animation speed to match your design
  • Tiny 🦐 — Individual loaders are < 1kb gzipped
  • No gifs 📷 — Built with HTML and modern CSS. A couple loaders use lightweight SVG as well
  • Zero dependencies ⛓️ — Zero worries.

Visit the 🌐 Website to see them all in action.

Built by Griffin Johnston for UI Ball

Installation

NPM

npm install @uiball/loaders

Yarn

yarn add @uiball/loaders

Getting Started

Import individual loader components. Use them wherever you like. The full list can be found on the website.

import { Waveform } from '@uiball/loaders'

export default function PageSection({ isLoading }) {
  return (
    <div aria-live="polite" aria-busy={isLoading}>
      {isLoading && <Waveform />}
    </div>
  )
}

Tree Shaking

This package is designed to maximize the benefits of tree shaking; so when you use a modern bundler like Webpack, Rollup or Parcel, and import { Orbit } from '@uiball/loaders' only the tiny code for the Orbit loader ends up in your app (most are less than 1kb).

Platform Support

This is a pure ESM library, so no require()-ing from CommonJS. It makes use of CSS custom properties (CSS variables) and keyframe animations, which work great in all modern browsers. Internet Explorer is not supported, however.

Next.js versions less than 12 don't transpile ESM modules by default and will throw an error. If you are using Next v11.1, you can add support with an experimental flag. Otherwise you can add support with this package: https://www.npmjs.com/package/next-transpile-modules.

Remix requires an additional step to import pure ESM packages. See https://remix.run/docs/en/v1/pages/gotchas#importing-esm-packages.

TL;DR — add the following code to remix.config.js:

module.exports = { serverDependenciesToBundle: ["@uiball/loaders"] };

Options

Each loader has different defaults. You can see them on the website. Click on an individual loader and open the "source" sidebar. Default values will be listed at the top, followed by HTML and CSS if you want to copy/paste rather than use the React components.

size: number

The size of the loader. Specifically, this defines the largest dimension (height or width) in pixels.

<Ring size={35} />

color: string

Any valid CSS color value is accepted, so #000000, red, hsl(13, 68%, 63%) and var(--my-custom-color) are all a-okay.

<Ring color="papayawhip" />

speed: number

The speed of the animation. Each loader uses this number a little differently (individual parts of a given loader might have different timings), but in general this number represents the duration of a single full animation loop in seconds, so smaller = faster. If you set speed to 0 or Infinity it will pause the animation.

<Ring speed={1.75} />

lineWeight: number

The width / stroke in pixels of line-based loaders like <Waveform /> or <RaceBy />. You can see if an individual loader supports this property on the website.

<Ring lineWeight={3.5} />

License

MIT