The HTML select element uses an attribute size to determine how many rows should be visible at one time in a scrolling select element.
The code below uses size="4" to show 4 options at once.
I would like to know how to get that same functionality using the Ant Design Select component in a React app.
I've tried setting the attributes size and multiple but neither work. I'm open to JavaScript solutions. Any ideas?
working code:
<select size="4">
<option id="apple" selected>Apple</option>
<option id="orange">Orange</option>
<option id="pineapple">Pineapple</option>
<option id="banana">Banana</option>
</select>
an example code of antd :
const { Select } = antd;
const { Option } = Select;
ReactDOM.render(
<Select
showSearch
style={{ width: 200 }}
placeholder="Search to Select"
optionFilterProp="children"
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
filterSort={(optionA, optionB) =>
optionA.children.toLowerCase().localeCompare(optionB.children.toLowerCase())
}
>
<Option value="1">Not Identified</Option>
<Option value="2">Closed</Option>
<Option value="3">Communicated</Option>
<Option value="4">Identified</Option>
<Option value="5">Resolved</Option>
<Option value="6">Cancelled</Option>
</Select>,
mountNode,
);