📑 Creates a select element.
Use the option(label, value) function to add new options to the select element.
option(label, value)
Set multiple to true to allow multiple options to be selected.
multiple
true
Use the value property to get or set the selected option value.
value
Use the selected property get the labels of the selected options or set the selected options by label. Can be a single string or an array of strings.
selected
Optional
optional placeholder text that appears before an option is selected
await Canvas(200, 100);let sel = createSelect('Select an option');sel.option('Red', '#f55');sel.option('Green', '#5f5');sel.addEventListener('change', () => { background(sel.value);}); Copy
await Canvas(200, 100);let sel = createSelect('Select an option');sel.option('Red', '#f55');sel.option('Green', '#5f5');sel.addEventListener('change', () => { background(sel.value);});
📑 Creates a select element.
Use the
option(label, value)function to add new options to the select element.Set
multipletotrueto allow multiple options to be selected.Use the
valueproperty to get or set the selected option value.Use the
selectedproperty get the labels of the selected options or set the selected options by label. Can be a single string or an array of strings.