@jswork/react-color-picker
v1.0.0
Published
A wrapper for react-color.
Downloads
27
Readme
react-color-picker
A wrapper for react-color.
installation
npm install -S @jswork/react-color-picker
properties
| Name | Type | Required | Default | Description | | --------- | ------ | -------- | ------- | ------------------------------------- | | className | string | false | - | The extended className for component. | | value | string | false | - | The changed value. | | onChange | func | false | noop | The change handler. |
usage
- import css
@import "~@jswork/react-color-picker/dist/style.css";
// or use sass
@import "~@jswork/react-color-picker/dist/style.scss";
// customize your styles:
$react-color-picker-options: ()
- import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactColorPicker from '@jswork/react-color-picker';
import './assets/style.scss';
class App extends React.Component {
state = {
value: '#ff6600'
};
onChange = (inEvent) => {
const { value } = inEvent.target;
this.setState({ value });
};
render() {
const { value } = this.state;
return (
<ReactDemokit
className="p-3 app-container"
url="https://github.com/afeiship/react-color-picker"
style={{ background: value }}>
<ReactColorPicker value={value} onChange={this.onChange} />
<div className="is-label">{value}</div>
</ReactDemokit>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
documentation
- https://afeiship.github.io/react-color-picker/
license
Code released under the MIT license.