material-ui-color
material-ui-color copied to clipboard
ColorPicker onChange is not updating the button color after the event fires
Describe the bug The specified handler fires, but the button itself remains white.
To Reproduce
<ColorPicker
id="newCategoryColour"
palette={colourOptions}
onChange={(e) => handleNewCategoryColour(e)}
hideTextfield
/>
Expected behavior The event should fire, and the button should change color to that specified.
Hello @Ormesome, as I understand you need to pass the value props to the component, so it will update the color, thank you!
const [color, setColor] = useState(createColor("red"));
const handleChange = (newValue: Color) => {
setColor(newValue);
};
//...
<ColorPicker
id="newCategoryColour"
palette={colourOptions}
value={color}
onChange={handleChange}
hideTextfield
/>