@arnaudpfu/react-color-picker
v0.2.2
Published
Simple react color picker.
Downloads
36
Maintainers
Readme
React Color Picker
Simple and customizable color picker.
Installation
npm i @arnaudpfu/react-color-picker
pnpm add @arnaudpfu/react-color-picker
Examples
import React, { useCallback } from 'react';
import ColorPicker, { ColorPickerHandler, SuperColor } from '@arnaudpfu/react-color-picker';
interface Props {
value: string;
onChange: (color: string) => void;
}
export const ColorPickerContainer: React.FC<Props> = ({
onChange,
value,
closeColorPicker,
parent,
}) => {
const updateColorOnChange: ColorPickerHandler = useCallback(
(color: SuperColor): void => {
onChange(color.toString());
},
[onChange]
);
return (
<ColorPicker defaultColor={value} onChange={updateColorOnChange} />
);
};
License
GPL licensed.