Horizontal#

Carousel horizontal example rendered by the production Go component.

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

Usage
previous, next := tree.ID(page, "previous"), tree.ID(page, "next")
carousel := components.BeginCarousel(canvas, theme, bounds, 3, state.carousel).
    Content(bounds.Width*3, float32(state.carousel)*bounds.Width).
    Controls(previous, "Previous slide", next, "Next slide")
carousel.BeginContent()
// Paint each slide at carousel.ItemGeometry(i, offset, bounds.Width).Bounds.
carousel.EndContent()
if canvas.Clicked(previous) && state.carousel > 0 {
    state.carousel--
} else if canvas.Clicked(next) && state.carousel < 2 {
    state.carousel++
}

Vertical#

Carousel vertical example rendered by the production Go component.

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

Usage
previous, next := tree.ID(page, "previous"), tree.ID(page, "next")
carousel := components.BeginCarousel(canvas, theme, bounds, 3, state.carousel).
    Content(bounds.Height*3, float32(state.carousel)*bounds.Height).
    Controls(previous, "Previous slide", next, "Next slide").Vertical()
carousel.BeginContent()
// Slides lay out down the content axis; ItemGeometry maps each one.
carousel.EndContent()
if canvas.Clicked(previous) && state.carousel > 0 {
    state.carousel--
} else if canvas.Clicked(next) && state.carousel < 2 {
    state.carousel++
}

Installation

Copy the recipe into your own project.

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

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.