react-color is a tiny color picker widget component for React apps. These components can be installed and used separately.
npm i @uiw/react-color
import { Slider, Sketch, Material, Colorful, Compact, Circle, Wheel, Block, Github, Chrome } from '@uiw/react-color';
import { Alpha, Hue, ShadeSlider, Saturation, Interactive, hsvaToHslaString } from '@uiw/react-color';
import { EditableInput, EditableInputRGBA, EditableInputHSLA } from '@uiw/react-color';
function Demo() {
const [hex, setHex] = useState("#fff");
return (
<Sketch
style={{ marginLeft: 20 }}
color={hex}
onChange={(color) => {
setHex(color.hex);
}}
/>
);
}
npm install # Installation dependencies
npm run bootstrap # Install dependencies in sub-packages
npm run hoist # Install dependencies in sub-packages
npm run build # Compile package
# listen to the component compile and output the .js file
# listen for compilation output type .d.ts file
npm run watch:color # Monitor the compiled package `@uiw/react-color`
npm run watch:alpha # Monitor the compiled package `@uiw/react-alpha`
npm run start # development mode, listen to compile preview website instance
Licensed under the MIT License.