1. Control:控制输入框和下拉箭头的显示。
```jsx
const CustomControl = (props) => (
<components.Control {...props} />
);
<Select
components={{ Control: CustomControl }}
/>
```
2. Option:自定义下拉选项的显示样式。
```jsx
const CustomOption = (props) => (
<components.Option {...props} />
);
<Select
components={{ Option: CustomOption }}
/>
```
3. MultiValue:自定义多选下拉框中选中选项的显示样式。
```jsx
const CustomMultiValue = (props) => (
<components.MultiValue {...props} />
);
<Select
components={{ MultiValue: CustomMultiValue }}
isMulti
/>
```
4. Placeholder:自定义输入框中的占位符文本。
```jsx
const CustomPlaceholder = (props) => (
<components.Placeholder {...props} />
);
<Select
components={{ Placeholder: CustomPlaceholder }}
/>
```
5. DropdownIndicator:自定义下拉箭头图标。
```jsx
const CustomDropdownIndicator = (props) => (
<components.DropdownIndicator {...props} />
);
<Select
components={{ DropdownIndicator: CustomDropdownIndicator }}
/>
6. SingleValue:自定义单选下拉框中选中选项的显示样式。
```jsx
const CustomSingleValue = (props) => (
<components.SingleValue {...props} />
);
<Select
components={{ SingleValue: CustomSingleValue }}
/>
```
7. Menu:自定义下拉菜单的整体样式和行为。
```jsx
const CustomMenu = (props) => (
<components.Menu {...props} />
);
<Select
components={{ Menu: CustomMenu }}
/>
```
8. MenuList:自定义下拉菜单中选项列表的样式和行为。
```jsx
const CustomMenuList = (props) => (
<components.MenuList {...props} />
);
<Select
components={{ MenuList: CustomMenuList }}
/>
```
9. ClearIndicator:自定义清除选项图标。
```jsx
const CustomClearIndicator = (props) => (
<components.ClearIndicator {...props} />
);
<Select
components={{ ClearIndicator: CustomClearIndicator }}
/>
10. IndicatorSeparator:自定义指示器之间的分隔符。
```jsx
const CustomIndicatorSeparator = (props) => (
<components.IndicatorSeparator {...props} />
);
<Select
components={{ IndicatorSeparator: CustomIndicatorSeparator }}
/>
```
11. LoadingIndicator:自定义加载指示器。
```jsx
const CustomLoadingIndicator = (props) => (
<components.LoadingIndicator {...props} />
);
<Select
components={{ LoadingIndicator: CustomLoadingIndicator }}
/>
```
12. ValueContainer:自定义选中值的容器。
```jsx
const CustomValueContainer = (props) => (
<components.ValueContainer {...props} />
);
<Select
components={{ ValueContainer: CustomValueContainer }}
/>
13. Group:自定义选项分组的显示样式。
```jsx
const CustomGroup = (props) => (
<components.Group {...props} />
);
<Select
components={{ Group: CustomGroup }}
/>
```
14. GroupHeading:自定义选项分组的标题样式。
```jsx
const CustomGroupHeading = (props) => (
<components.GroupHeading {...props} />
);
<Select
components={{ GroupHeading: CustomGroupHeading }}
/>
```
15. NoOptionsMessage:自定义没有匹配选项时显示的提示信息。
```jsx
const CustomNoOptionsMessage = (props) => (
<components.NoOptionsMessage {...props} />
);
<Select
components={{ NoOptionsMessage: CustomNoOptionsMessage }}
/>
16. MultiValueLabel:自定义多选下拉框中选中选项的标签部分的样式。
```jsx
const CustomMultiValueLabel = (props) => (
<components.MultiValueLabel {...props} />
);
<Select
components={{ MultiValueLabel: CustomMultiValueLabel }}
isMulti
/>
```
17. MultiValueRemove:自定义多选下拉框中选中选项的移除按钮。
```jsx
const CustomMultiValueRemove = (props) => (
<components.MultiValueRemove {...props} />
);
<Select
components={{ MultiValueRemove: CustomMultiValueRemove }}
isMulti
/>
18. ClearIndicator:自定义清除选项的图标和行为。
```jsx
const CustomClearIndicator = (props) => (
<components.ClearIndicator {...props} />
);
<Select
components={{ ClearIndicator: CustomClearIndicator }}
/>
```
19. LoadingMessage:自定义加载选项时显示的提示信息。
```jsx
const CustomLoadingMessage = (props) => (
<components.LoadingMessage {...props} />
);
<Select
components={{ LoadingMessage: CustomLoadingMessage }}
/>
```
20. ValueContainer:自定义选中值的容器样式和行为。
```jsx
const CustomValueContainer = (props) => (
<components.ValueContainer {...props} />
);
<Select
components={{ ValueContainer: CustomValueContainer }}
/>
21. Placeholder:自定义输入框中的占位符文本样式。
```jsx
const CustomPlaceholder = (props) => (
<components.Placeholder {...props} />
);
<Select
components={{ Placeholder: CustomPlaceholder }}
/>
```
22. IndicatorSeparator:自定义指示器之间的分隔符样式。
```jsx
const CustomIndicatorSeparator = (props) => (
<components.IndicatorSeparator {...props} />
);
<Select
components={{ IndicatorSeparator: CustomIndicatorSeparator }}
/>
```
23. SingleValue:自定义单选下拉框中选中选项的显示样式。
```jsx
const CustomSingleValue = (props) => (
<components.SingleValue {...props} />
);
<Select
components={{ SingleValue: CustomSingleValue }}
/>
24. DropdownIndicator:自定义下拉箭头图标样式。
```jsx
const CustomDropdownIndicator = (props) => (
<components.DropdownIndicator {...props} />
);
<Select
components={{ DropdownIndicator: CustomDropdownIndicator }}
/>
```
25. ClearValue:自定义清除选中值的图标和行为。
```jsx
const CustomClearValue = (props) => (
<components.ClearValue {...props} />
);
<Select
components={{ ClearValue: CustomClearValue }}
/>
```
26. MenuPortal:自定义下拉菜单的渲染位置。
```jsx
const CustomMenuPortal = (props) => (
<components.MenuPortal {...props} />
);
<Select
components={{ MenuPortal: CustomMenuPortal }}
/>
27. ValueContainer:自定义选中值的容器样式和行为。
```jsx
const CustomValueContainer = (props) => (
<components.ValueContainer {...props} />
);
<Select
components={{ ValueContainer: CustomValueContainer }}
/>
```
28. MultiValueContainer:自定义多选下拉框中选中选项的容器样式。
```jsx
const CustomMultiValueContainer = (props) => (
<components.MultiValueContainer {...props} />
);
<Select
components={{ MultiValueContainer: CustomMultiValueContainer }}
isMulti
/>
```
29. DropdownIndicator:自定义下拉箭头图标样式。
```jsx
const CustomDropdownIndicator = (props) => (
<components.DropdownIndicator {...props} />
);
<Select
components={{ DropdownIndicator: CustomDropdownIndicator }}
/>
30. ValueContainer:自定义选中值的容器样式和行为。
```jsx
const CustomValueContainer = (props) => (
<components.ValueContainer {...props} />
);
<Select
components={{ ValueContainer: CustomValueContainer }}
/>
```
31. GroupHeading:自定义选项分组的标题样式。
```jsx
const CustomGroupHeading = (props) => (
<components.GroupHeading {...props} />
);
<Select
components={{ GroupHeading: CustomGroupHeading }}
/>
```
32. IndicatorSeparator:自定义指示器之间的分隔符样式。
```jsx
const CustomIndicatorSeparator = (props) => (
<components.IndicatorSeparator {...props} />
);
<Select
components={{ IndicatorSeparator: CustomIndicatorSeparator }}
/>
React-select 相关API属性用法
于 2024-05-14 10:34:29 首次发布