Skip to main content

Multi Select

The Multi Select widget provides a dropdown menu that allows users to select multiple options from a list of choices.

States

StateTypeDefaultDescription
value[]int32[]Array of selected option indices

Properties

PropertyTypeDefaultDescription
labelstring""Label text displayed above the multi-select
options[]string[]Array of option labels to display in the dropdown
placeholderstring""Placeholder text displayed when no options are selected
default_value[]int32[]Initial selected option indices
requiredboolFalseWhether at least one selection is required
disabledboolFalseWhether the multi-select is disabled

Examples

Basic Multi Select

package main

import (
"github.com/trysourcetool/sourcetool-go"
"github.com/trysourcetool/sourcetool-go/multiselect"
)

func main() {
func page(ui sourcetool.UIBuilder) error {
// Create a basic multi-select
multiSelect := ui.MultiSelect("Skills", multiselect.Placeholder("Select your skills"), multiselect.Options("Go", "JavaScript", "Python", "SQL", "Docker"))
}
}

Multi Select with Default Values

// Create a multi-select with default values
multiSelect := ui.MultiSelect("Skills", multiselect.Placeholder("Select your skills"), multiselect.Options("Go", "JavaScript", "Python", "SQL", "Docker"), multiselect.DefaultValue("Go", "Python"))
  • Select - For selecting a single option from a list
  • CheckboxGroup - Alternative for selecting multiple options from a visible list