mb-react-color-picker

A React component that enables to pick color through HSV/HEX/RGBA.
Install
npm i mb-react-color-picker
About
class ColorPicker extends React.component {
static propTypes = {
color: PropTypes.string,
onChange: PropTypes.func,
onConfirm: PropTypes.func,
applyDidMountSideEffect: PropTypes.func,
applyWillUnmountSideEffect: PropTypes.func,
themeColors: PropTypes.array,
customColors: PropTypes.array,
customColorsHeaderText: PropTypes.string,
onDragStart: PropTypes.func,
onClose: PropTypes.func,
headerText: PropTypes.string,
}
render () {
...
}
}
Usage
import React, { Component } from 'react'
import ColorPicker from 'mb-react-color-picker'
class Example extends Component {
state = {
color: '#996633'
}
handleChange = color => this.setState({ color })
render () {
const { color } = this.state
return (
<ColorPicker
color={color}
onChange={this.handleChange}
/>
)
}
}
Also, you can wrap a custom color picker element, for example, a eyedropper color picker, into the <ColorPicker> as its child, to enhance the color picker. The custom color picker will receive hex, alpha, handleChange as props to interchange color with the <ColorPicker>. You can check the usage in /example/src/App.js
Demo
Pick me :hearts:
License
MIT © mockingbot