4.3.0 • Published 8 years ago

react-colorpickr v4.3.0

Weekly downloads
370
License
BSD-3-Clause
Repository
github
Last release
8 years ago

A colorpicker for React

npm version Circle CI

Demo

Install

npm install react-colorpickr

You'll also want to include a copy of colorpickr.css in your code.

<link href='react-colorpickr.css' rel='stylesheet' />

Usage

var React = require('react');
var ColorPicker = require('react-colorpickr');

var App = React.createClass({
  getInitialState: function() {
    return {
      color: 'rgba(56, 130, 184, 1)'
    };
  },

  onChange: function(color) {
    console.log(color);
  },

  render: function() {
    return (
      <div>
        <ColorPicker
          value={this.state.color}
          onChange={this.onChange} />
      </div>
    );
  }
});

Required properties

onChange

Value should be a function and is called whenever a color is updated from the colorpicker. Returns a color object.

Optional properties

value

Accepts a string formatted as: HSV, HSVA, HSL, HSLA, RGBA, RGBA, HEX, named colors (e.g 'red'). If this isn't provided, a default color is used.

mode

Defaults to rgb. Initializes which color model tab is active. Possible options: hsv, rgb.

colorAttribute

Defaults to h. Initializes which color attribute is active. Possible options: h, s, v, r, g, b.

reset

If reset is provided as a property with a value of true a reset button is added that when pressed, reverts back to the original color when the colorpicker is initialized on the page. Defaults to true.

Developing

npm install & npm start

Inspired by https://github.com/wangzuo/react-input-color

4.3.0

8 years ago

4.2.0

8 years ago

4.1.2

8 years ago

4.1.1

8 years ago

4.1.1-alpha

8 years ago

4.1.0-alpha

8 years ago

4.0.0-alpha

8 years ago

3.0.2

8 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.4.5

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago