Skip to main content
The select field stores one or more string values from a predefined list of options. It supports both single-select and multi-select modes, with special setter modifiers for manipulating selections.

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 values list
  • 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

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 values list 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 values lists (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 []