Select¶
Select shows the chosen option in a field. When the user presses the field, it opens a list of the other options. The list can filter as the user types.
Usage¶
Call Components.Select with a scope and a table of properties:
C.Select(scope, {
Label = "Country",
Options = {
{ Value = "ca", Label = "Canada" },
{ Value = "jp", Label = "Japan" },
},
Filterable = true,
OnChanged = function(value)
print("Chose", value)
end,
})
Properties¶
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Theme |
ThemeRef |
The contextual theme | Theme to use for this component instead of the one from Theme.Provide. |
|
LayoutOrder |
UsedAs<number> |
0 |
Position in a parent UIListLayout or UIGridLayout. |
|
Size |
UsedAs<UDim2> |
- | Size of the component. | |
ZIndex |
UsedAs<number> |
- | Z index of the component. | |
Options |
{ SelectOption } |
- | The options, each with a Value and a Label. |
|
Value |
UsedAs<string> |
"" |
The value. A plain value is only the starting value. A Value stays in step with the control: the user's changes set it, and setting it changes the control. |
|
Placeholder |
UsedAs<string> |
"Select…" |
Text to show while nothing is chosen. | |
Label |
UsedAs<string> |
- | Label above the field. | |
Disabled |
UsedAs<boolean> |
- | Stops the field opening. The component reads this once, when it creates the field. | |
Filterable |
boolean |
false |
Show a search box that filters the list. Combobox is a Select with this turned on. | |
Validators |
{ Validator } |
- | Validators to run on the chosen value. | |
Id |
string |
- | Key that identifies this component when state is kept across rebuilds. See Persist. |
Callbacks¶
| Name | Description |
|---|---|
OnChanged: (string) -> () |
Runs with the Value of the option the user chose. |