- Basic Usage
- Select with search field
- multiple selection
- Sizes
- Custom selection render
- Search with sort
- Tags
- Option Group
- coordinate
- Search Box
- Get value of selected item
- Automatic tokenization
- Search and Select Users
- Custom dropdown
- Hide Already Selected
- Bordered-less
- Custom Tag Render
- Responsive maxTagCount
- Big Data
- Status
- Placement
- API
Select
Select component to select value from options.
When To Use#
A dropdown menu for displaying choices - an elegant alternative to the native
<select>
element.Utilizing Radio is recommended when there are fewer total options (less than 5).
Examples
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const handleChange = (value: string) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<>
<Select defaultValue="lucy" style={{ width: 120 }} onChange={handleChange}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="disabled" disabled>
Disabled
</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
<Select defaultValue="lucy" style={{ width: 120 }} disabled>
<Option value="lucy">Lucy</Option>
</Select>
<Select defaultValue="lucy" style={{ width: 120 }} loading>
<Option value="lucy">Lucy</Option>
</Select>
<Select defaultValue="lucy" style={{ width: 120 }} allowClear>
<Option value="lucy">Lucy</Option>
</Select>
</>
);
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const children: React.ReactNode[] = [];
for (let i = 10; i < 36; i++) {
children.push(<Option key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const handleChange = (value: string[]) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<>
<Select
mode="multiple"
allowClear
style={{ width: '100%' }}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
>
{children}
</Select>
<br />
<Select
mode="multiple"
disabled
style={{ width: '100%' }}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
>
{children}
</Select>
</>
);
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const handleChange = (value: string[]) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<Select
mode="multiple"
style={{ width: '100%' }}
placeholder="select one country"
defaultValue={['china']}
onChange={handleChange}
optionLabelProp="label"
>
<Option value="china" label="China">
<div className="demo-option-label-item">
<span role="img" aria-label="China">
🇨🇳
</span>
China (中国)
</div>
</Option>
<Option value="usa" label="USA">
<div className="demo-option-label-item">
<span role="img" aria-label="USA">
🇺🇸
</span>
USA (美国)
</div>
</Option>
<Option value="japan" label="Japan">
<div className="demo-option-label-item">
<span role="img" aria-label="Japan">
🇯🇵
</span>
Japan (日本)
</div>
</Option>
<Option value="korea" label="Korea">
<div className="demo-option-label-item">
<span role="img" aria-label="Korea">
🇰🇷
</span>
Korea (韩国)
</div>
</Option>
</Select>
);
export default App;
.demo-option-label-item > span {
margin-right: 6px;
}
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const children: React.ReactNode[] = [];
for (let i = 10; i < 36; i++) {
children.push(<Option key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const handleChange = (value: string) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<Select mode="tags" style={{ width: '100%' }} placeholder="Tags Mode" onChange={handleChange}>
{children}
</Select>
);
export default App;
import { Select } from 'infrad';
import React, { useState } from 'react';
const { Option } = Select;
const provinceData = ['Zhejiang', 'Jiangsu'];
const cityData = {
Zhejiang: ['Hangzhou', 'Ningbo', 'Wenzhou'],
Jiangsu: ['Nanjing', 'Suzhou', 'Zhenjiang'],
};
type CityName = keyof typeof cityData;
const App: React.FC = () => {
const [cities, setCities] = useState(cityData[provinceData[0] as CityName]);
const [secondCity, setSecondCity] = useState(cityData[provinceData[0] as CityName][0]);
const handleProvinceChange = (value: CityName) => {
setCities(cityData[value]);
setSecondCity(cityData[value][0]);
};
const onSecondCityChange = (value: CityName) => {
setSecondCity(value);
};
return (
<>
<Select defaultValue={provinceData[0]} style={{ width: 120 }} onChange={handleProvinceChange}>
{provinceData.map(province => (
<Option key={province}>{province}</Option>
))}
</Select>
<Select style={{ width: 120 }} value={secondCity} onChange={onSecondCityChange}>
{cities.map(city => (
<Option key={city}>{city}</Option>
))}
</Select>
</>
);
};
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const handleChange = (value: { value: string; label: React.ReactNode }) => {
console.log(value); // { value: "lucy", key: "lucy", label: "Lucy (101)" }
};
const App: React.FC = () => (
<Select
labelInValue
defaultValue={{ value: 'lucy', label: 'Lucy (101)' }}
style={{ width: 120 }}
onChange={handleChange}
>
<Option value="jack">Jack (100)</Option>
<Option value="lucy">Lucy (101)</Option>
</Select>
);
export default App;
import { Select, Spin } from 'infrad';
import type { SelectProps } from 'infrad/es/select';
import debounce from 'lodash/debounce';
import React, { useMemo, useRef, useState } from 'react';
export interface DebounceSelectProps<ValueType = any>
extends Omit<SelectProps<ValueType | ValueType[]>, 'options' | 'children'> {
fetchOptions: (search: string) => Promise<ValueType[]>;
debounceTimeout?: number;
}
function DebounceSelect<
ValueType extends { key?: string; label: React.ReactNode; value: string | number } = any,
>({ fetchOptions, debounceTimeout = 800, ...props }: DebounceSelectProps<ValueType>) {
const [fetching, setFetching] = useState(false);
const [options, setOptions] = useState<ValueType[]>([]);
const fetchRef = useRef(0);
const debounceFetcher = useMemo(() => {
const loadOptions = (value: string) => {
fetchRef.current += 1;
const fetchId = fetchRef.current;
setOptions([]);
setFetching(true);
fetchOptions(value).then(newOptions => {
if (fetchId !== fetchRef.current) {
// for fetch callback order
return;
}
setOptions(newOptions);
setFetching(false);
});
};
return debounce(loadOptions, debounceTimeout);
}, [fetchOptions, debounceTimeout]);
return (
<Select
labelInValue
filterOption={false}
onSearch={debounceFetcher}
notFoundContent={fetching ? <Spin size="small" /> : null}
{...props}
options={options}
/>
);
}
// Usage of DebounceSelect
interface UserValue {
label: string;
value: string;
}
async function fetchUserList(username: string): Promise<UserValue[]> {
console.log('fetching user', username);
return fetch('https://randomuser.me/api/?results=5')
.then(response => response.json())
.then(body =>
body.results.map(
(user: { name: { first: string; last: string }; login: { username: string } }) => ({
label: `${user.name.first} ${user.name.last}`,
value: user.login.username,
}),
),
);
}
const App: React.FC = () => {
const [value, setValue] = useState<UserValue[]>([]);
return (
<DebounceSelect
mode="multiple"
value={value}
placeholder="Select users"
fetchOptions={fetchUserList}
onChange={newValue => {
setValue(newValue as UserValue[]);
}}
style={{ width: '100%' }}
/>
);
};
export default App;
import { Select } from 'infrad';
import React, { useState } from 'react';
const OPTIONS = ['Apples', 'Nails', 'Bananas', 'Helicopters'];
const App: React.FC = () => {
const [selectedItems, setSelectedItems] = useState<string[]>([]);
const filteredOptions = OPTIONS.filter(o => !selectedItems.includes(o));
return (
<Select
mode="multiple"
placeholder="Inserted are removed"
value={selectedItems}
onChange={setSelectedItems}
style={{ width: '100%' }}
>
{filteredOptions.map(item => (
<Select.Option key={item} value={item}>
{item}
</Select.Option>
))}
</Select>
);
};
export default App;
import { Select, Tag } from 'infrad';
import type { CustomTagProps } from 'rc-select/lib/BaseSelect';
import React from 'react';
const options = [{ value: 'gold' }, { value: 'lime' }, { value: 'green' }, { value: 'cyan' }];
const tagRender = (props: CustomTagProps) => {
const { label, value, closable, onClose } = props;
const onPreventMouseDown = (event: React.MouseEvent<HTMLSpanElement>) => {
event.preventDefault();
event.stopPropagation();
};
return (
<Tag
color={value}
onMouseDown={onPreventMouseDown}
closable={closable}
onClose={onClose}
style={{ marginRight: 3 }}
>
{label}
</Tag>
);
};
const App: React.FC = () => (
<Select
mode="multiple"
showArrow
tagRender={tagRender}
defaultValue={['gold', 'cyan']}
style={{ width: '100%' }}
options={options}
/>
);
export default App;
Infra Design 4.0
100000 Items
Infra Design 3.0
import type { SelectProps } from 'infrad';
import { Divider, Select, Typography } from 'infrad';
import React from 'react';
const { Title } = Typography;
const options: SelectProps['options'] = [];
for (let i = 0; i < 100000; i++) {
const value = `${i.toString(36)}${i}`;
options.push({
label: value,
value,
disabled: i === 10,
});
}
const handleChange = (value: string[]) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<>
<Title level={3}>Infra Design 4.0</Title>
<Title level={4}>{options.length} Items</Title>
<Select
mode="multiple"
style={{ width: '100%' }}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
options={options}
/>
<Divider />
<Title level={3}>Infra Design 3.0</Title>
<iframe
title="Infra Design 3.0 Select demo"
src="https://codesandbox.io/embed/solitary-voice-m3vme?fontsize=14&hidenavigation=1&theme=dark&view=preview"
style={{ width: '100%', height: 300 }}
/>
</>
);
export default App;
import type { RadioChangeEvent } from 'infrad';
import { Radio, Select } from 'infrad';
import type { SelectCommonPlacement } from 'infrad/es/_util/motion';
import React, { useState } from 'react';
const { Option } = Select;
const App: React.FC = () => {
const [placement, SetPlacement] = useState<SelectCommonPlacement>('topLeft');
const placementChange = (e: RadioChangeEvent) => {
SetPlacement(e.target.value);
};
return (
<>
<Radio.Group value={placement} onChange={placementChange}>
<Radio.Button value="topLeft">topLeft</Radio.Button>
<Radio.Button value="topRight">topRight</Radio.Button>
<Radio.Button value="bottomLeft">bottomLeft</Radio.Button>
<Radio.Button value="bottomRight">bottomRight</Radio.Button>
</Radio.Group>
<br />
<br />
<Select
defaultValue="HangZhou"
style={{ width: 120 }}
dropdownMatchSelectWidth={false}
placement={placement}
>
<Option value="HangZhou">HangZhou #310000</Option>
<Option value="NingBo">NingBo #315000</Option>
<Option value="WenZhou">WenZhou #325000</Option>
</Select>
</>
);
};
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const onChange = (value: string) => {
console.log(`selected ${value}`);
};
const onSearch = (value: string) => {
console.log('search:', value);
};
const App: React.FC = () => (
<Select
showSearch
placeholder="Select a person"
optionFilterProp="children"
onChange={onChange}
onSearch={onSearch}
filterOption={(input, option) =>
(option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="tom">Tom</Option>
</Select>
);
export default App;
import type { RadioChangeEvent } from 'infrad';
import { Radio, Select } from 'infrad';
import type { SizeType } from 'infrad/es/config-provider/SizeContext';
import React, { useState } from 'react';
const { Option } = Select;
const children: React.ReactNode[] = [];
for (let i = 10; i < 36; i++) {
children.push(<Option key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const handleChange = (value: string | string[]) => {
console.log(`Selected: ${value}`);
};
const App: React.FC = () => {
const [size, setSize] = useState<SizeType>('middle');
const handleSizeChange = (e: RadioChangeEvent) => {
setSize(e.target.value);
};
return (
<>
<Radio.Group value={size} onChange={handleSizeChange}>
<Radio.Button value="large">Large</Radio.Button>
<Radio.Button value="default">Default</Radio.Button>
<Radio.Button value="small">Small</Radio.Button>
</Radio.Group>
<br />
<br />
<Select size={size} defaultValue="a1" onChange={handleChange} style={{ width: 200 }}>
{children}
</Select>
<br />
<Select
mode="multiple"
size={size}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
style={{ width: '100%' }}
>
{children}
</Select>
<br />
<Select
mode="tags"
size={size}
placeholder="Please select"
defaultValue={['a10', 'c12']}
onChange={handleChange}
style={{ width: '100%' }}
>
{children}
</Select>
</>
);
};
export default App;
.code-box-demo .ant-select {
margin: 0 8px 10px 0;
}
.ant-row-rtl .code-box-demo .ant-select {
margin: 0 0 10px 8px;
}
#components-select-demo-search-box .code-box-demo .ant-select {
margin: 0;
}
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const App: React.FC = () => (
<Select
showSearch
style={{ width: 200 }}
placeholder="Search to Select"
optionFilterProp="children"
filterOption={(input, option) => (option!.children as unknown as string).includes(input)}
filterSort={(optionA, optionB) =>
(optionA!.children as unknown as string)
.toLowerCase()
.localeCompare((optionB!.children as unknown as string).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>
);
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option, OptGroup } = Select;
const handleChange = (value: string) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<Select defaultValue="lucy" style={{ width: 200 }} onChange={handleChange}>
<OptGroup label="Manager">
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
</OptGroup>
<OptGroup label="Engineer">
<Option value="Yiminghe">yiminghe</Option>
</OptGroup>
</Select>
);
export default App;
import jsonp from 'fetch-jsonp';
import { Select } from 'infrad';
import qs from 'qs';
import React, { useState } from 'react';
const { Option } = Select;
let timeout: ReturnType<typeof setTimeout> | null;
let currentValue: string;
const fetch = (value: string, callback: (data: { value: string; text: string }[]) => void) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
currentValue = value;
const fake = () => {
const str = qs.stringify({
code: 'utf-8',
q: value,
});
jsonp(`https://suggest.taobao.com/sug?${str}`)
.then((response: any) => response.json())
.then((d: any) => {
if (currentValue === value) {
const { result } = d;
const data = result.map((item: any) => ({
value: item[0],
text: item[0],
}));
callback(data);
}
});
};
timeout = setTimeout(fake, 300);
};
const SearchInput: React.FC<{ placeholder: string; style: React.CSSProperties }> = props => {
const [data, setData] = useState<any[]>([]);
const [value, setValue] = useState<string>();
const handleSearch = (newValue: string) => {
if (newValue) {
fetch(newValue, setData);
} else {
setData([]);
}
};
const handleChange = (newValue: string) => {
setValue(newValue);
};
const options = data.map(d => <Option key={d.value}>{d.text}</Option>);
return (
<Select
showSearch
value={value}
placeholder={props.placeholder}
style={props.style}
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
onSearch={handleSearch}
onChange={handleChange}
notFoundContent={null}
>
{options}
</Select>
);
};
const App: React.FC = () => <SearchInput placeholder="input search text" style={{ width: 200 }} />;
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const children: React.ReactNode[] = [];
for (let i = 10; i < 36; i++) {
children.push(<Option key={i.toString(36) + i}>{i.toString(36) + i}</Option>);
}
const handleChange = (value: string) => {
console.log(`selected ${value}`);
};
const App: React.FC = () => (
<Select mode="tags" style={{ width: '100%' }} onChange={handleChange} tokenSeparators={[',']}>
{children}
</Select>
);
export default App;
import { Select } from 'infrad';
import React from 'react';
const { Option } = Select;
const App: React.FC = () => (
<>
<Select defaultValue="lucy" style={{ width: 120 }} bordered={false}>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
<Select defaultValue="lucy" style={{ width: 120 }} disabled bordered={false}>
<Option value="lucy">Lucy</Option>
</Select>
</>
);
export default App;
import type { SelectProps } from 'infrad';
import { Select, Space } from 'infrad';
import React, { useState } from 'react';
interface ItemProps {
label: string;
value: string;
}
const options: ItemProps[] = [];
for (let i = 10; i < 36; i++) {
const value = i.toString(36) + i;
options.push({
label: `Long Label: ${value}`,
value,
});
}
const App: React.FC = () => {
const [value, setValue] = useState(['a10', 'c12', 'h17', 'j19', 'k20']);
const selectProps: SelectProps = {
mode: 'multiple',
style: { width: '100%' },
value,
options,
onChange: (newValue: string[]) => {
setValue(newValue);
},
placeholder: 'Select Item...',
maxTagCount: 'responsive',
};
return (
<Space direction="vertical" style={{ width: '100%' }}>
<Select {...selectProps} />
<Select {...selectProps} disabled />
</Space>
);
};
export default App;
import { Select, Space } from 'infrad';
import React from 'react';
const App: React.FC = () => (
<Space direction="vertical" style={{ width: '100%' }}>
<Select status="error" style={{ width: '100%' }} />
<Select status="warning" style={{ width: '100%' }} />
</Space>
);
export default App;
#components-select-demo-status .ant-select {
margin: 0;
}
API#
<Select>
<Option value="lucy">lucy</Option>
</Select>
Select props#
Property | Description | Type | Default | Version |
---|---|---|---|---|
allowClear | Show clear button | boolean | false | |
autoClearSearchValue | Whether the current search will be cleared on selecting an item. Only applies when mode is set to multiple or tags | boolean | true | |
autoFocus | Get focus by default | boolean | false | |
bordered | Whether has border style | boolean | true | |
clearIcon | The custom clear icon | ReactNode | - | |
defaultActiveFirstOption | Whether active first option by default | boolean | true | |
defaultOpen | Initial open state of dropdown | boolean | - | |
defaultValue | Initial selected option | string | string[] number | number[] LabeledValue | LabeledValue[] | - | |
disabled | Whether disabled select | boolean | false | |
dropdownClassName | The className of dropdown menu | string | - | |
dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set min-width same as input. Will ignore when value less than select width. false will disable virtual scroll | boolean | number | true | |
dropdownRender | Customize dropdown content | (originNode: ReactNode) => ReactNode | - | |
dropdownStyle | The style of dropdown menu | CSSProperties | - | |
fieldNames | Customize node label, value, options field name | object | { label: label , value: value , options: options } | 4.17.0 |
filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option , if the function returns true , the option will be included in the filtered set; Otherwise, it will be excluded | boolean | function(inputValue, option) | true | |
filterSort | Sort function for search options sorting, see Array.sort's compareFunction | (optionA: Option, optionB: Option) => number | - | 4.9.0 |
getPopupContainer | Parent Node which the selector should be rendered to. Default to body . When position issues happen, try to modify it into scrollable content and position it relative. Example | function(triggerNode) | () => document.body | |
labelInValue | Whether to embed label in value, turn the format of value from string to { value: string, label: ReactNode } | boolean | false | |
listHeight | Config popup height | number | 256 | |
loading | Indicate loading state | boolean | false | |
maxTagCount | Max tag count to show. responsive will cost render performance | number | responsive | - | responsive: 4.10 |
maxTagPlaceholder | Placeholder for not showing tags | ReactNode | function(omittedValues) | - | |
maxTagTextLength | Max tag text length to show | number | - | |
menuItemSelectedIcon | The custom menuItemSelected icon with multiple options | ReactNode | - | |
mode | Set mode of Select | multiple | tags | - | |
notFoundContent | Specify content to show when no result matches | ReactNode | Not Found | |
open | Controlled open state of dropdown | boolean | - | |
optionFilterProp | Which prop value of option will be used for filter if filterOption is true. If options is set, it should be set to label | string | value | |
optionLabelProp | Which prop value of option will render as content of select. Example | string | children | |
options | Select options. Will get better perf than jsx definition | { label, value }[] | - | |
placeholder | Placeholder of select | ReactNode | - | |
placement | The position where the selection box pops up | bottomLeft bottomRight topLeft topRight | bottomLeft | |
removeIcon | The custom remove icon | ReactNode | - | |
searchValue | The current input "search" text | string | - | |
showArrow | Whether to show the drop-down arrow | boolean | true(for single select), false(for multiple select) | |
showSearch | Whether show search input in single mode | boolean | false | |
size | Size of Select input | large | middle | small | middle | |
status | Set validation status | 'error' | 'warning' | - | 4.19.0 |
suffixIcon | The custom suffix icon | ReactNode | - | |
tagRender | Customize tag render, only applies when mode is set to multiple or tags | (props) => ReactNode | - | |
tokenSeparators | Separator used to tokenize, only applies when mode="tags" | string[] | - | |
value | Current selected option (considered as a immutable array) | string | string[] number | number[] LabeledValue | LabeledValue[] | - | |
virtual | Disable virtual scroll when set to false | boolean | true | 4.1.0 |
onBlur | Called when blur | function | - | |
onChange | Called when select an option or input value change | function(value, option:Option | Array<Option>) | - | |
onClear | Called when clear | function | - | 4.6.0 |
onDeselect | Called when an option is deselected, param is the selected option's value. Only called for multiple or tags , effective in multiple or tags mode only | function(string | number | LabeledValue) | - | |
onDropdownVisibleChange | Called when dropdown open | function(open) | - | |
onFocus | Called when focus | function | - | |
onInputKeyDown | Called when key pressed | function | - | |
onMouseEnter | Called when mouse enter | function | - | |
onMouseLeave | Called when mouse leave | function | - | |
onPopupScroll | Called when dropdown scrolls | function | - | |
onSearch | Callback function that is fired when input changed | function(value: string) | - | |
onSelect | Called when an option is selected, the params are option's value (or key) and option instance | function(string | number | LabeledValue, option: Option) | - |
Note, if you find that the drop-down menu scrolls with the page, or you need to trigger Select in other popup layers, please try to use
getPopupContainer={triggerNode => triggerNode.parentElement}
to fix the drop-down popup rendering node in the parent element of the trigger .
Select Methods#
Name | Description | Version |
---|---|---|
blur() | Remove focus | |
focus() | Get focus |
Option props#
Property | Description | Type | Default | Version |
---|---|---|---|---|
className | The additional class to option | string | - | |
disabled | Disable this option | boolean | false | |
title | title attribute of Select Option | string | - | |
value | Default to filter with this property | string | number | - |
OptGroup props#
Property | Description | Type | Default | Version |
---|---|---|---|---|
key | Group key | string | - | |
label | Group label | string | React.Element | - |
FAQ#
Why sometime search will show 2 same option when in tag
mode?#
It's caused by option with different label
and value
. You can use optionFilterProp="label"
to change filter logic instead.
The dropdown is closed when click dropdownRender
area?#
Dropdown menu will be closed if click dropdownRender
area, you can prevent it by wrapping onMouseDown={e => e.preventDefault()}
(see more at #13448).
Why sometime customize Option cause scroll break?#
Virtual scroll internal set item height as 32px
. You need to adjust listItemHeight
when your option height is less and listHeight
config list container height:
<Select listItemHeight={10} listHeight={250} />
Note: listItemHeight
and listHeight
are internal props. Please only modify when necessary.
Why a11y test report missing aria-
props?#
Select only create a11y auxiliary node when operating on. Please open Select and retry. For aria-label
& aria-labelledby
miss warning, please add related prop to Select with your own requirement.