This content originally appeared on DEV Community and was authored by PrimeTek
React ColorPicker is an input component to select a color.
Setup
Refer to PrimeReact setup documentation for download and installation steps for your environment.
Import
import {ColorPicker} from 'primereact/colorpicker';
Getting Started
ColorPicker is used as a controlled input component with value and onChange properties.
<ColorPicker value={color} onChange={(e) => setColor(e.value)} />
Formats
Default color format to use in value binding is "hex" and other possible values are "rgb" and "hsb". Example below has 3 colorpickers having default values with different formats.
<ColorPicker value={color1} onChange={(e) => setColor1(e.value)} />
<ColorPicker format="rgb" value={color2} onChange={(e) => setColor2(e.value)} />
<ColorPicker format="hsb" value={color3} onChange={(e) => setColor3(e.value)}/>
Theming
ColorPicker supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.
Resources
Visit the PrimeReact ColorPicker showcase for demos and documentation.
This content originally appeared on DEV Community and was authored by PrimeTek
PrimeTek | Sciencx (2021-02-07T14:49:07+00:00) React ColorPicker. Retrieved from https://www.scien.cx/2021/02/07/react-colorpicker/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.