Reputation: 77
I want to replace the default dropdown select arrow with and icon provided by ant design (https://ant.design/components/icon/), for example the DownCircleOutlined. Is it possible? This is my current code. I do not have any styles for it yet as I do not know the approach.
<Select>
<Option value="1">a</Option>
<Option value="2">b</Option>
<Option value="3">c</Option>
</Select>
Upvotes: 7
Views: 23561
Reputation: 1721
Use the suffixIcon
prop on the Select
component.
https://codesandbox.io/s/select-with-search-field-ant-design-demo-k217c?file=/index.js:0-679
Like so:
import React from 'react'
import ReactDOM from 'react-dom'
import 'antd/dist/antd.css'
import './index.css'
import { Select } from 'antd'
import { DownCircleTwoTone } from '@ant-design/icons'
const { Option } = Select
ReactDOM.render(
<Select
suffixIcon={<DownCircleTwoTone />}
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="tom">Tom</Option>
</Select>,
document.getElementById('container')
)
Upvotes: 15