material-ui-color icon indicating copy to clipboard operation
material-ui-color copied to clipboard

ColorPicker onChange is not updating the button color after the event fires

Open Ormesome opened this issue 4 years ago • 1 comments

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.

Ormesome avatar Jul 29 '21 12:07 Ormesome

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
/>

lifeeric avatar Oct 18 '21 16:10 lifeeric