Combobox
The ty-combobox
component is a versatile control that combines a drop-down list with an editable text box, allowing users to either select a value from the list or enter a custom value. It is particularly useful in scenarios where the list of options is long or when the user is expected to know the item they are selecting.
Usage
Here's how you can use the ty-select
component in your HTML code:
Live Editor
<ty-combobox placeholder="Type or choose an fruit"> <ty-option value="apple" label="Apple"></ty-option> <ty-option value="banana" label="Banana"></ty-option> <ty-option value="watermelon" label="Watermelon"></ty-option> </ty-combobox>
Result
Loading...
API
The ty-combobox
component accepts the following properties:
Properties
Name | Description | Type | Default |
---|---|---|---|
placeholder | Placeholder text | String | '' |
value | Value of the selected option | String | '' |
label | label of the selected option | String | '' |
disabled | Disable the select component | Boolean | false |
Events
Name | Description | Detail |
---|---|---|
ty-change | Fires when the select changes | { value: string, label: string } |