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
Select API#
Property | Description | Type | Default Value |
---|---|---|---|
Bordered | ParameterToggle the border style. | Boolean | true |
EnableVirtualization | ParameterWhether to enable virtualization feature or not, only works for .NET 5 and higher | Boolean | false |
DataSource | ParameterThe datasource for this component. | IEnumerable<TItem> | -- |
DataSourceEqualityComparer | ParameterEqualityComparer that will be used during DataSource change detection. If no comparer set, default .Net is going to be used. | IEqualityComparer<TItem> | -- |
DefaultActiveFirstOption | ParameterActivates the first item that is not deactivated. | Boolean | -- |
DisabledName | ParameterThe name of the property to be used as a disabled indicator. | String | -- |
DropdownMatchSelectWidth | ParameterWill match dropdown width. If true , matches width of the widest item in the dropdown. If string , matches width of the string's value (ex: 250px) |
OneOf<Boolean, String> | true |
DropdownMaxWidth | ParameterWill not allow dropdown width to grow above stated in here value (eg. "768px") | String | auto |
GroupName | ParameterThe name of the property to be used as a group indicator. If the value is set, the entries are displayed in groups. Use additional AntDesign.SelectBase`2.SortByGroup and AntDesign.SelectBase`2.SortByLabel . |
String | -- |
IgnoreItemChanges | ParameterIs used to increase the speed. If you expect changes to the label name, group name or disabled indicator, disable this property. | Boolean | true |
ItemTemplate | ParameterIs used to customize the item style. | RenderFragment<TItem> | -- |
NotFoundContent | ParameterSpecify content to show when no result matches. | RenderFragment | -- |
OnBlur | ParameterCalled when blur. | Action | -- |
OnCreateCustomTag | ParameterCalled when custom tag is created. | Action<String> | -- |
OnDataSourceChanged | ParameterCalled when the datasource object/reference changes. It does not trigger if a value inside the datasource changes. | Action | -- |
OnDropdownVisibleChange | ParameterCalled when the dropdown visibility changes. | Action<Boolean> | -- |
OnSearch | ParameterCallback function that is fired when input changed. | Action<String> | -- |
FilterExpression | Parameter | Func<SelectOptionItem<TItemValue, TItem>, String, Boolean> | -- |
PopupContainerMaxHeight | Parameter | String | -- |
ShowArrowIcon | ParameterWhether to show the drop-down arrow | Boolean | true |
TokenSeparators | ParameterDefine what characters will be treated as token separators for newly created tags. Useful when creating new tags using only keyboard. | Char[] | -- |
ValueChanged | ParameterUsed for the two-way binding. | EventCallback<TItemValue> | -- |
Value | ParameterGet or set the selected value. | TItemValue | -- |
LabelProperty | ParameterSpecifies the label property in the option object. If use this property, should not use Obsolete Will be removed in a future version. |
Func<TItem, String> | -- |
ValueProperty | ParameterSpecifies the value property in the option object. If use this property, should not use Obsolete Will be removed in a future version. |
Func<TItem, TItemValue> | -- |
DisabledPredicate | ParameterSpecifies predicate for disabled options | Func<TItem, Boolean> | -- |
DefaultValue | ParameterUsed when Mode = default - The value is used during initialization and when pressing the Reset button within Forms. | TItemValue | -- |
ListboxStyle | Parameter | String | -- |
BoundaryAdjustMode | ParameterOverlay adjustment strategy (when for example browser resize is happening) | TriggerBoundaryAdjustMode | -- |
AllowClear | ParameterShow clear button. Has no effect if AntDesign.AntInputComponentBase`1.Value type default is also in the list of SelectOption , unless used with AntDesign.SelectBase`2.ValueOnClear . |
Boolean | -- |
AutoClearSearchValue | ParameterWhether the current search will be cleared on selecting an item. | Boolean | -- |
Disabled | ParameterWhether the Select component is disabled. | Boolean | -- |
Mode | ParameterSet mode of Select - default | multiple | tags | String | -- |
EnableSearch | ParameterIndicates whether the search function is active or not. Always true for mode tags. | Boolean | -- |
SearchDebounceMilliseconds | ParameterDelays the processing of the search input event until the user has stopped typing for a predetermined amount of time. Default to 250ms. | Int32 | -- |
Loading | ParameterShow loading indicator. You have to write the loading logic on your own. | Boolean | -- |
Open | ParameterControlled open state of dropdown. | Boolean | -- |
OpenChanged | ParameterCallback function that is called when open state changes. | EventCallback<Boolean> | -- |
Placeholder | ParameterPlaceholder of select. | String | -- |
OnFocus | ParameterCalled when focus. | EventCallback | -- |
AutoFocus | ParameterAuto focus. | Boolean | -- |
SortByGroup | ParameterThe name of the property to be used as a group indicator. If the value is set, the entries are displayed in groups. Use additional SortByGroup and SortByLabel. | SortDirection | -- |
SortByLabel | ParameterSort items by label value. None | Ascending | Descending | SortDirection | -- |
HideSelected | ParameterHides the selected items when they are selected. | Boolean | -- |
ValuesChanged | ParameterUsed for the two-way binding. | EventCallback<IEnumerable<TItemValue>> | -- |
SuffixIcon | ParameterThe custom suffix icon. | RenderFragment | -- |
PrefixIcon | ParameterThe custom prefix icon. | RenderFragment | -- |
AccessKey | ParameterThe accesskey global attribute. | String | -- |
DefaultValues | ParameterUsed when Mode = multiple | tags - The values are used during initialization and when pressing the Reset button within Forms. | IEnumerable<TItemValue> | -- |
OnClearSelected | ParameterCalled when the user clears the selection. | EventCallback | -- |
OnSelectedItemChanged | ParameterCalled when the selected item changes. | EventCallback<TItem> | -- |
OnSelectedItemsChanged | ParameterCalled when the selected items changes. | EventCallback<IEnumerable<TItem>> | -- |
Values | ParameterGet or set the selected values. | IEnumerable<TItemValue> | -- |
CustomTagLabelToValue | ParameterConverts custom tag (a string) to TItemValue type. | Func<String, TItemValue> | -- |
SelectOptions | ParameterUsed for rendering select options manually. | RenderFragment | -- |
MaxTagTextLength | ParameterHow long (number of characters) a tag will be. Only for Mode = "multiple" or Mode = "tags" | Int32 | -- |
LabelInValue | ParameterWhether to embed label in value, turn the format of value from TItemValue to string (JSON) e.g. { "value": TItemValue, "label": "Label value" } | Boolean | -- |
MaxTagCount | ParameterMax tag count to show. responsive will cost render performance. | OneOf<Int32, ResponsiveTag> | -- |
ValueOnClear | ParameterWhen Clear button is pressed, Value will be set to whatever is set in ValueOnClear | TItemValue | -- |
ItemLabel | ParameterSpecifies the label property in the option object. If use this property, should not use AntDesign.SelectBase`2.LabelName |
Func<TItem, String> | -- |
ItemValue | ParameterSpecifies the value property in the option object. If use this property, should not use AntDesign.SelectBase`2.ValueName |
Func<TItem, TItemValue> | -- |
LabelName | ParameterThe name of the property to be used for the label. | String | -- |
ValueName | ParameterThe name of the property to be used for the value. | String | -- |
OnMouseEnter | ParameterCalled when mouse enter. | Action | -- |
OnMouseLeave | ParameterCalled when mouse leave. | Action | -- |
PopupContainerSelector | ParameterUse this to fix overlay problems e.g. #area | String | -- |
DropdownRender | ParameterCustomize dropdown content. The context is the original content. | RenderFragment<RenderFragment> | -- |
LabelTemplate | ParameterIs used to customize the label style. | RenderFragment<TItem> | -- |
MaxTagPlaceholder | ParameterPlaceholder for hidden tags. If used with ResponsiveTag.Responsive, implement your own handling logic. | RenderFragment<IEnumerable<TItem>> | -- |
ShowSearchIcon | ParameterWhether show search input in single mode. | Boolean | -- |
ValidationMessages | Validation messages for the FormItem | String[] | -- |
AdditionalAttributes | ParameterGets or sets a collection of additional attributes that will be applied to the created element. | IReadOnlyDictionary<String, Object> | -- |
ValueExpression | ParameterAn expression that identifies the bound value. | Expression<Func<TItemValue>> | -- |
ValuesExpression | ParameterAn expression that identifies the enumerable of bound values. | Expression<Func<IEnumerable<TItemValue>>> | -- |
Size | ParameterThe size of the input box. Note: in the context of a form, the `large` size is used. Available: `large` `default` `small` | String | AntSizeLDSType.Default |
CultureInfo | ParameterWhat Culture will be used when converting string to value and value to string Useful for InputNumber component. | CultureInfo | CultureInfo.CurrentCulture |
Id | ParameterID for the component's HTML | String | Uniquely Generated ID |
Class | ParameterSpecifies one or more class names for an DOM element. | String | -- |
Style | ParameterSpecifies an inline style for a DOM element. | String | -- |
RefBack | ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current . |
ForwardRef | -- |