GithubHelp home page GithubHelp logo

dkress59 / react-loading-icons Goto Github PK

View Code? Open in Web Editor NEW
59.0 2.0 4.0 3.48 MB

A TypeScript-React edition of Sam Herbert's amazing SVG Loaders.

Home Page: https://loading.damiankress.de

License: Other

JavaScript 2.46% TypeScript 96.40% HTML 0.92% Shell 0.22%
svg-loaders svg loaders react react-loading react-loading-animation svg-icons svg-animations react-svg react-library

react-loading-icons's Introduction

React Loading Icons

npm version weekly downloads Unit Test CI Integration Test CI codecov

A pure SVG zero-dependency React adaptation of Sam Herbert's SVG Loaders library.

Built with React 17 and TypeScript. Check out the Demo!

Also works with JavaScript, of course (supports ESM tree shaking).

Usage

Install from NPM

yarn add react-loading-icons
npm install react-loading-icons

Import all the loaders in a namespaced fashion

You can import all the loaders at once:

import LoadingIcons from 'react-loading-icons'

and use them in a namespaced manner:

<LoadingIcons.Bars />

Import an individual loader

You can also import a single loader:

import { Bars } from 'react-loading-icons'

and use it without any fancy namespacing:

<Bars />

You can even go as far as copying over a single .js file from the dist/components directory to your project โ€” this way you can directly import a certain loading icon without having to import the whole package.

Components

<Audio />
<BallTriangle />
<Bars />
<Circles />
<Grid />
<Hearts />
<Oval />
<Puff />
<Rings />
<SpinningCircles />
<TailSpin />
<ThreeDots />

Options

Each of these components will accept any SVG tag presentation attributes as well as all valid JSX properties (key, onClick, โ€ฆ) as props. Animation speed can be controlled via speed attribute (1 = 100% speed, .5 = 50% speed, 2 = 200%, and so on). The components are also smart about inheriting fill, fillOpacity, stroke, strokeOpactiy and strokeWidth, so these can also easily be controlled.

Common Usage

// renders the Puff icon with a mint green stroke
<Puff stroke="#98ff98" />

// renders the Puff icon's mint green stroke with an opacity of 12.5%
<Puff stroke="#98ff98" strokeOpacity={.125} />

// renders the Puff icon at 75% speed with a mint green stroke with an opacity of 12.5%
<Puff stroke="#98ff98" strokeOpacity={.125} speed={.75} />

react-loading-icons's People

Contributors

dkress59 avatar gh-action-bump-version avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-loading-icons's Issues

Speed animation config

Hello, thanks for this library,

is there any way to tweak the speed of the animation rotation ?

Thanks

Package unmaintained

I'm sorry to say but the author of this package passed away. He was a good friend and a great developer.

This package is therefore unmaintained. If someone would like to take over and continue building / maintaining this package - you can create a fork and publish a new version. Please give credit for his work to Damian Kress - the author of this package.

Support for tree shaking

In my project I use only one icon but when I build the app and run a bundle analyzer all icons are bundled:

image

Most packages usually ship a second build which uses ES6 imports (this is required by many bundlers for tree shaking). To point bundlers at that build they have a module entry in package.json which points to the index file of the ESM build. Here's an example of Redux Toolkit:

https://github.com/reduxjs/redux-toolkit/blob/c6164cbd45d0f9665e775295f7986b666035e0ab/packages/toolkit/package.json#L26

package.json dist/redux-toolkit.esm.js

A workaround I use for now:
image
image

It would be awesome if I didn't have to use the workaround. Let me know if you need help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.