Skip to main content

Select

The Select component provides a dropdown interface for selecting one or multiple options from a predefined list. It supports search, validation, and multiple selection modes.

Overview

Select provides a complete dropdown solution with:

  • Single and multiple selection
  • Searchable options
  • Clearable selection
  • Custom option rendering
  • Validation support
  • Block layout option

Basic Usage

{
uuid: "my-select",
name: "country_select",
component_type: "select",
input: {
placeholder: { type: "string", value: "Select a country" },
label: { type: "string", value: "Country" }
},
inputHandlers: {
options: `
return [
{ label: 'United States', value: 'us' },
{ label: 'United Kingdom', value: 'uk' },
{ label: 'Canada', value: 'ca' },
{ label: 'Australia', value: 'au' }
];
`
},
event: {
onChange: `
$selectedCountry = EventData.value;
`
}
}

Component Inputs

PropertyTypeDefaultDescription
valuestring | string[]''Selected value(s)
optionsarray[]Array of option objects
placeholderstring'Select an option'Placeholder text
searchPlaceholderstring'Search options...'Search input placeholder
labelstring''Label text
helperstring''Helper text
selectionModestring'single'Selection mode: 'single', 'multiple'
searchablebooleanfalseEnable search
clearablebooleanfalseEnable clear button
requiredbooleanfalseMark as required
blockbooleanfalseFull-width display
disabledbooleanfalseDisable select
statestring'default'State: 'default', 'disabled'
sizestring'medium'Size: 'small', 'medium', 'large'

Events

onChange

Triggered: When selection changes

EventData:

{
value: string | string[] // Selected value(s)
}

onFocus / onBlur

Triggered: When select receives/loses focus

onDropdownOpen / onDropdownClose

Triggered: When dropdown opens/closes

onValidation

Triggered: When validation occurs

EventData:

{
isValid: boolean
message: string
}

Common Patterns

Dependent Selects

// Country select
{
uuid: "country-select",
component_type: "select",
input: { label: { type: "string", value: "Country" } },
inputHandlers: {
options: `return [{ label: 'USA', value: 'us' }, { label: 'Canada', value: 'ca' }];`
},
event: {
onChange: `
$selectedCountry = EventData.value;
$selectedCity = null;
$cities = await LoadCities(EventData.value);
`
}
}

// City select (dependent)
{
uuid: "city-select",
component_type: "select",
input: { label: { type: "string", value: "City" } },
inputHandlers: {
options: `return $cities || [];`,
disabled: `return !$selectedCountry;`
},
event: {
onChange: `$selectedCity = EventData.value;`
}
}

Multi-Select Tags

{
component_type: "select",
input: {
selectionMode: { type: "string", value: "multiple" },
searchable: { type: "boolean", value: true },
placeholder: { type: "string", value: "Select tags" }
},
inputHandlers: {
options: `return $availableTags.map(tag => ({ label: tag.name, value: tag.id }));`,
value: `return $selectedTags || [];`
},
event: {
onChange: `$selectedTags = EventData.value;`
}
}

See Also