docs/documentation/04.02-helpers.md
Every color picker provided is made up of a collection of helper components. Those components are accessible for you to use to make a custom color picker.
Use Alpha to display a slider to toggle the alpha value. Make sure to wrap it in a div that's the size you want the slider to be and that it is position: relative.
var { Alpha } = require('react-color/lib/components/common');
<Alpha
{...this.props}
pointer={ CustomPointer }
onChange={ this.handleChange } />
Use EditableInput to display an input / label that acts as the single source of truth until the input is blurred.
{ wrap: {}, input: {}, label: {} }var { EditableInput } = require('react-color/lib/components/common');
var inputStyles = {
input: {
border: none,
},
label: {
fontSize: '12px',
color: '#999',
},
};
<EditableInput
style={ inputStyles }
label="hex"
value={ this.props.hex }
onChange={ this.handleChange } />
Use Hue to display a slider to toggle the hue value. Make sure to wrap it in a div that's the size you want the slider to be and that it is position: relative.
var { Hue } = require('react-color/lib/components/common');
<Hue
{...this.props}
pointer={ CustomPointer }
onChange={ this.handleChange }
direction={ 'horizontal' || 'vertical' } />
Use Saturation to display a saturation block that users can drag to change the value. Make sure to wrap it in a div that's the size you want the block to be and that it is position: relative.
var { Saturation } = require('react-color/lib/components/common');
<Saturation
{...this.props}
pointer={ CustomPointer }
onChange={ this.handleChange } />
The Checkboard component renders a background of black / white checkerboard for use when displaying gradients or alpha. Make sure to wrap it in a div that's the size you want the block to be and that it is position: relative.
8transparentrgba(0,0,0,.08)var { Checkboard } = require('react-color/lib/components/common');
<Checkboard
size={ 12 }
white="#fff"
grey="#333" />