Select Flags
Multi-option flags that let users pick between variants.
<vibe-flags-select> lets users choose between multiple options. Each option is defined as a <vibe-flags-option> child — only the active option's children are rendered.
Basic usage
The toolbar shows a dropdown for this flag. Selecting an option hides all other options' children and shows the selected one.
Attributes
<vibe-flags-select>
| Attribute | Type | Default | Description |
|---|---|---|---|
name | string | '' | Unique flag identifier. Required. |
description | string | '' | Label shown in the toolbar. Falls back to name. |
default | string | first option | The option value to use as the initial selection. Must match a child <vibe-flags-option value>. Falls back to the first option if omitted or invalid. |
custom | boolean | false | When present, adds a "Custom..." option to the toolbar dropdown with a free-text input. |
<vibe-flags-option>
| Attribute | Type | Default | Description |
|---|---|---|---|
value | string | '' | The option identifier. Children are shown only when this option is active. |
Patterns
Setting a default option
Without default, the first option is selected. Use default to start at a different option:
Custom values
Add the custom attribute to let users type any value in the toolbar — useful for dynamic values like API URLs or experiment IDs:
Selecting "Custom..." in the toolbar reveals a text input. The typed value is stored and persisted like any other selection.
A/B testing UI variants
Select flags are ideal for comparing multiple designs side by side:
Multiple elements, same flag
Like boolean flags, multiple elements can reference the same select flag. They all update together: