ComboBox
is a form control for selecting a single value from a set of options. It is similar to Select but with a major difference – possibility to enter value manually . ComboBox
is the tuiFilterByInput
pipe. It enables item filtering based on the user’s input as they type. strict
mode is enabled. This means the input value must match one of the options from the data list. If the value doesn't match, the form control is not updated and the input is cleared on blur. In non-strict mode, the form control can contain any value — even if it doesn’t match any item in the data list.
Form control:null
tuiFilterByInput
pipe. Textfield
: add any number of Icons and Tooltips (with control over their order and color), adjust the size of the textbox, and more. Explore Textfield documentation page for more customization options. null
as argument to tui-data-list-wrapper[items]
to show loader inside the dropdown. Additionally, you can put Loader inside textfield's box. Pass empty array to tui-data-list-wrapper[items]
to show tui-data-list-wrapper[emptyContent]
(it accepts PolymorpheusContent
).
tuiItemsHandlersProvider
to override the default behavior of all ComboBox
-s below the current DI scope. To customize a specific ComboBox
, use the input properties [identityMatcher]
/ [stringify]
/ disabledItemHandler
(inherited from Textfield
).
[itemContent]
property. Also, Textfield has [content]
property to customize appearance of selected option inside textbox. Both properties accept PolymorpheusContent
– it empowers you with extremely large possibilities for customization.
DataListWrapper
is just a helper to solve most popular use cases. Use DataList
for more complex cases when great flexibility is required. DataList documentation page for more customization options. DataList
exposes Option
-directives – it provides you with an opportunity to decide which data type put inside its [value]
. This example demonstrates how every option can be a complex object with any structure but form control contains a single id-property as number
-type.
Form control:777
ComboBox
with virtual scrolling from @angular/cdk/scrolling . Put tuiDropdownMobile
on <tui-textfield />
to enable a full-screen dialog instead of the default dropdown on mobile devices.
By default, the full-screen dialog hides all other content using visibility: hidden
and shifts the textfield to the top of the page. Use --tui-dropdown-mobile-offset
css-variable option to control how far the textfield is shifted. If needed, manually set visibility: visible
on any hidden elements (e.g., a sticky header) to make them visible again.
tuiAsOptionContent
-utility. <tui-data-list-wrapper [itemContent]="..." />
can be enough for your task.