Default#

Collapsible default example rendered by the production Go component.

Enable JavaScript to run the preview. Go source and install commands remain available.

Usage
trigger := tree.ID(page, "trigger")
collapsible := components.BeginCollapsible(canvas, theme, trigger, bounds)
content := collapsible.Paint("3 build artifacts", open, 112)
if canvas.Clicked(trigger) {
    open = !open
}
canvas.Rounded(content, theme.Metrics.RadiusSurface, theme.Muted)

Disabled#

Collapsible disabled example rendered by the production Go component.

Enable JavaScript to run the preview. Go source and install commands remain available.

Usage
trigger := tree.ID(page, "trigger")
collapsible := components.BeginCollapsible(canvas, theme, trigger, bounds).Disabled()
content := collapsible.Paint("3 build artifacts", open, 112)
if content.Height > 0 {
    canvas.Rounded(content, theme.Metrics.RadiusSurface, theme.Muted)
}

Installation

Copy the recipe into your own project.

Repository command
go run ./cmd/viva add --out ./components/local collapsible

Source-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.