Search code examples
reactjsantd

AntD Change color of Icon


I'm using v4 of AntD and have imported @ant-design/icons in order to use LeftOutlined.

In the docs for antd icons (https://ant.design/components/icon/) It lists the following for the fill attribute:

fill | Define the color used to paint the svg element | string | 'currentColor'

I assumed that this meant I could do this but it is not working:

<RightOutlined fill="#4E89FF" />

Instead for now I am using the style attribute and is working:

style | The computed style of the svg element | CSSProperties | -

<LeftOutlined style={{color: "#4E89FF"}} />

. .

Did I misunderstand the fill attribute?


Solution

  • That section of the docs you reference is for custom SVGs that you import. The api for their icons such as the one's you're trying to use are above that.