React Dojo

Search

Search concepts, exercises and quizzes

practicebasic

Color picker

A color picker with a preset palette and a custom color input. Shows the selected color in a preview swatch and its hex value.


Objectives

  1. 1.Declare selectedColor state with initial value #3b82f6
  2. 2.On click: update selectedColor with the clicked color
  3. 3.Highlight the selected color in the palette
  4. 4.Wire up the input type=color to pick a custom color
  5. 5.Show the selected color in the preview swatch and its hex value
your code
Hint

Use input type='color' for the custom color picker.

Related concepts

Was this helpful?
Sign in to give feedback