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

@zumper/react-ladda

v7.2.4

Published

React wrapper for Ladda buttons

Downloads

708

Readme

@zumper/react-ladda

A React wrapper for Ladda buttons. Example

NOTE

This project started as a fork of react-ladda.

Differences:

  • props without the cumbersome data- prefix are allowed
  • upgraded to ladda 2 see here
  • modern build system with es, cjs and umd builds
  • plays nicely with create-react-app and other modern build systems

Installation

@zumper/react-ladda can be installed directly through npm:

# with NPM
$ npm install --save @zumper/react-ladda

# with yarn
$ yarn add @zumper/react-ladda

Usage

LaddaButton is a React component that renders a Ladda button. You can change the button's loading state and progress using the loading and progress props.

import React, { Component } from 'react'
import LaddaButton, { XL, SLIDE_UP } from '@zumper/react-ladda'

class MyButton extends Component {
  state = { loading: false, progress: 0 }

  onClick = () => {
    this.setState((state) => ({
      loading: true,
      progress: 0.5,
    }))
  }

  render() {
    const { loading, progress } = this.state
    return (
      <LaddaButton
        loading={loading}
        progress={progress}
        onClick={this.onClick}
        color="mint"
        size={XL}
        style={SLIDE_UP}
        spinnerSize={30}
        spinnerColor="#ddd"
        spinnerLines={12}
      >
        Click Here!
      </LaddaButton>
    )
  }
}

export default MyButton

Including styles

Although this package doesn't include the styles for the Ladda buttons, there are many different ways to include them. You can read about how to manage CSS in the Ladda docs.

With Webpack

If you are using webpack (or create-react-app) to build your project you can easily import the required styles directly from the ladda package.

// import the ladda theme directly from the ladda package.
import 'ladda/dist/ladda.min.css'

// optionally import the themeless styles to style the buttons yourself.
import 'ladda/dist/ladda-themeless.min.css'

With SCSS

If you are using scss (or create-react-app) on your project you can import the scss styles directly from the ladda package.

// import themeless styles directly from the ladda package
@import '~ladda/css/ladda';

// OR import the themed styles
@import '~ladda/css/ladda-themed';

Props

All of the native Ladda button options are supported through props:

| Prop | Type | Description | | -------------------------------------- | --------- | ----------------------------------------------------- | | loading | boolean | Displays the button's loading indicator | | progress | number | Number from 0.0 to 1.0 | | color or data-color | string | Color applied to the button (A color) | | size or data-size | string | A button size | | style or data-style | string | A button style | | spinnerSize or data-spinner-size | number | Number representing the size of the spinner in pixels | | spinnerColor or data-spinner-color | string | Color applied to the spinner (eg. #eee) | | spinnerLines or data-spinner-lines | number | Number of spokes in the spinner |

Colors, Sizes and Styles

Ladda comes with a variety of different sizes and styles that you can use. Button sizes and styles can be directly imported from @zumper/react-ladda:

import LaddaButton, { GREEN, XS, EXPAND_LEFT } from '@zumper/react-ladda'

Colors

  • GREEN
  • RED
  • BLUE
  • PURPLE
  • MINT

Sizes

  • XS
  • S
  • L
  • XL

Styles

  • CONTRACT
  • CONTRACT_OVERLAY
  • EXPAND_LEFT
  • EXPAND_RIGHT
  • EXPAND_UP
  • EXPAND_DOWN
  • SLIDE_LEFT
  • SLIDE_RIGHT
  • SLIDE_UP
  • SLIDE_DOWN
  • ZOOM_IN
  • ZOOM_OUT