Hover Card
View sourcecomponents/hover_card.goDefault#
Hover Card default example rendered by the production Go component.
trigger := f.Button(anchorID, "@viva-framework").Outline().Width(180)
if canvas.Hovered() == anchorID {
card := components.BeginHoverCard(canvas, theme, viewport, trigger.Rect(), components.HoverCardOptions{
Layer: 1, Side: components.HoverCardBottom, BodyHeight: 24,
})
layout := card.Begin("Viva Framework", "Go-first, GPU-native desktop UI.")
canvas.Label("Native • Retained", layout.Body, labelStyle)
card.End()
}Sides#
Hover Card sides example rendered by the production Go component.
trigger := f.Button(anchorID, "@viva-framework").Outline().Width(180)
card := components.BeginHoverCard(canvas, theme, viewport, trigger.Rect(), components.HoverCardOptions{
Layer: 1, Side: components.HoverCardRight, Align: components.HoverCardAlignCenter,
ContentSize: ui.Size{Width: min(280, size.Width-32)}, BodyHeight: 24,
})
layout := card.Begin("Viva Framework", "Placed right and clamped to the viewport.")
canvas.Label("@viva-framework", layout.Body, labelStyle)
card.End()Disabled#
Hover Card disabled example rendered by the production Go component.
trigger := f.Button(anchorID, "@viva-framework").Outline().Width(180)
card := components.BeginHoverCard(canvas, theme, viewport, trigger.Rect(),
components.HoverCardOptions{Layer: 1, Side: components.HoverCardBottom}).Disabled()
card.Paint("Viva Framework", "A disabled trigger shows no preview.")Installation
Copy the recipe into your own project.
go run ./cmd/viva add --out ./components/local hover-cardSource-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.