1.0.5 • Published 7 years ago

react-fancy-button v1.0.5

Weekly downloads
249
License
MIT
Repository
github
Last release
7 years ago

react-fancy-button

React component button with spinner.

Fancy Button Demo

  NOTE: v1.0.x has upgrade React to v16. If using older version React, please use latest previous version 0.2.21.

Install

npm install react-fancy-button --save

Usage

  import FancyButton from 'react-fancy-button';

  React.createClass({

  save() {
    this.setState({isSavingNote: true});
    console.log('saving!')
  },

  isFormValid() {
    return someValidations();
  },

  render() {
    <FancyButton classes='btn btn--small btn-primary btn--full'
       onClick={this.save}
       disabled={isFormValid()}
       trigger={this.state.isSavingNote}
       onDisabledClick={ () => this.setState({ showErrors: true }) }
       label='Save'/>
  }

Params

classes {String} string of classes on button element

type {String} type of button

label {Any} content in button

onDisabledClick {Function} action on click of disabled button

trigger {Boolean hides/shows spinner and disabled more subsequent clicks from happening unless allowMultiClick is true

disabled {Boolean} disables button

onClick {String} action on click

role {String} aria role for button - defaults to 'button'

ariaLabel {String} aria-label for button - defaults to what prop.label is set to

allowMultiClick {Boolean} defaults to false. If true, it will allow onClick handler to be triggered even if the prop trigger is true

Tests:

To run the tests you can either run:

  npm test

OR

  npm test -- --debug=true // for debug mode in chrome
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.21

7 years ago

0.2.20

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

7 years ago

0.2.15

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.93

8 years ago

0.1.92

8 years ago

0.1.91

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.71

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago