Package Exports
- react-color-palette
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-color-palette) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-color-palette
Color picker for React
Installation
npm
npm install react-color-palette styled-components
yarn
yarn add react-color-palette styled-components
Usage
import React, { useState } from "react";
import ColorPicker from "react-color-palette";
export const App = () => {
const [color, setColor] = useState("#121212");
return (
<ColorPicker
width={225}
color={color}
onChange={color => setColor(color.hex)}
/>
);
};
Props
width
The width of the palette (since the palette is square, the same value will be used for the height).
color
Initial color (HEX or HTML Color Name).
onChange
A function that accepts an object of the updated color as a single argument. The object contains 3 color models: hex, rgb and hsb.
License
Code released under the MIT license.