Configuration options
[]string
required
List of accepted values. This defines all possible options that can be selected.
int
default:"1"
Maximum number of values that can be selected. Set to 1 (or less) for single-select mode. Set to > 1 for multi-select mode.
bool
default:"false"
When true, requires at least one value to be selected.
Validation rules
The select field validates:- Values: All selected values must be in the predefined
valueslist - Max select: Number of selected values cannot exceed
maxSelect - Required: If enabled, at least one value must be selected
Single vs multi-select
The field behavior changes based on
maxSelect:maxSelect <= 1: Single-select mode (value is a string)maxSelect > 1: Multi-select mode (value is a string array)
Special setter modifiers
The select field supports several modifiers for manipulating selections:Go examples
- Single select
- Multi select
- With modifiers
- Priority/category
Database column type
The column type varies based on whether it’s single or multi-select:Common use cases
Querying select fields
Best practices
- Keep the
valueslist concise and meaningful - Use single-select for mutually exclusive options (status, priority, etc.)
- Use multi-select for non-exclusive categorization (tags, permissions, etc.)
- Consider the UX implications of large
valueslists (use relation fields for large datasets) - Use
+and-modifiers in multi-select mode for cleaner code - Selections are stored in order, duplicates are automatically removed
Zero value
- Single-select: Empty string
"" - Multi-select: Empty array
[]