Skip to content

RickeyWard/react-ladda-button

Repository files navigation

react-ladda-button

Hooks based ladda buttons port in typescript with hooks

This is a port of Ladda by Hakim El Hattab

NPM JavaScript Style Guide

Install

npm install --save react-ladda-button

Usage

import React, { Component } from 'react'

import LaddaButton, {EXPAND_LEFT} from 'react-ladda-button'
import 'react-ladda-button/dist/ladda-themeless.min.css'

class Example extends Component {
  render() {
    return <LaddaButton data-style={EXPAND_LEFT}>I'm a button!</LaddaButton>
  }
}

More examples in the Live Demo. The API is virtually identical to Ladda.

considerations

The spinner style attributes are only used on first spinner creation, then the spinner is cached. This seems like something that likely never changes. If you need these to change, use a key to force the button to get recreated. This isn't an oversight its a conscious choice.

License

MIT © RickeyWard

Contributing

this library was bootstrapped with create-react-library and yarn

yarn start

then in another terminal

cd example && yarn start