Default#
Select default example rendered by the production Go component.
item := tree.Sub(page, tree.Name("item"))
values := []string{"metal", "d3d", "vulkan"}
control := components.BeginSelect(canvas, theme, bounds, components.SelectOptions{
TriggerID: tree.ID(page, "trigger"), Label: "Renderer", Value: value,
Placeholder: "Select a backend", Open: open, Content: content, Layer: 4,
Scope: tree.ID(page, "content"), DismissID: tree.ID(page, "dismiss"),
})
control.AddLabel("Native backends")
for index, label := range []string{"Metal", "Direct3D", "Vulkan"} {
control.AddItem(components.SelectItem{
ID: item.At(index), Label: label, Value: values[index],
Selected: value == values[index],
})
}
control.End()States#
Select states example rendered by the production Go component.
components.BeginSelect(canvas, theme, invalidBounds, components.SelectOptions{
TriggerID: tree.ID(page, "trigger"), Label: "Renderer",
Value: "", Placeholder: "Select a backend", Invalid: true,
})
components.BeginSelect(canvas, theme, disabledBounds, components.SelectOptions{
TriggerID: tree.ID(page, "disabled"), Label: "Unavailable",
Placeholder: "Backend unavailable", Disabled: true,
Size: components.SelectSizeSmall,
})Installation
Copy the recipe into your own project.
go run ./cmd/viva add --out ./components/local selectSource-owned usage#
This preview calls the production Go component directly. Stable IDs, values and open state remain owned by the application; the component only paints and declares interaction semantics.
- Read the linked component source for every option and visual decision.
- Use the native command to verify system text, focus, accessibility and platform integration.
- The browser preview validates shared layout and scene behavior, not native performance.
Verification boundary#
The examples cover representative states supported by the current API. They do not imply that every desktop backend has completed hardware validation.
Keyboard
Use Tab to move between controls and Ctrl/⌘ K to search the catalog. Inside a preview, the Go runtime handles keyboard input.