How to change the color of a check box in antd?

Hen*_*aye 3 reactjs antd

import { Checkbox } from 'antd' 

<Checkbox style={{ color: 'red', backgroundColor: 'black' }}>Dr John</Checkbox>
Run Code Online (Sandbox Code Playgroud)

How to change the color of the check box not the label 'Dr John'? The above style only change the styles of the label not the check box?

hum*_*ean 7

您可以使用简单的CSS

.ant-checkbox-checked .ant-checkbox-inner {
  background-color: red;
  border-color: red;
}
Run Code Online (Sandbox Code Playgroud)

  • 我想动态应用 css(根据给定的输入,一系列复选框的不同颜色)。 (2认同)
  • 这是我使用样式组件所做的 codeSandBox [链接](https://codesandbox.io/embed/n59zxxxyol)。让我知道它是否有效。 (2认同)