React Js – How to change a color in checkbox when it is checked?

Howto change the color in the checkbox when it is checked?
When my checkbox is checked, it has this color: enter image description here

But i want to change to red.

How i can do that?

  <input
        type="checkbox"
        disabled={isDisabled}
        defaultChecked={checked}
        onChange={() => setChecked(!checked)}
      />

>Solution :

You can use accent-color css property:

JsFiddle

input[type='checkbox'] {
  accent-color: red;
}
 <input type="checkbox" />

Keep the browser support in mind when using this.

Leave a Reply