Default#

Table default example rendered by the production Go component.

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

Usage
rows := tree.Sub(page, tree.Name("row"))
table := components.BeginTable(canvas, theme, bounds, columns)
table.Header([]string{"Item", "Status", "Amount"})
for index, cells := range bills {
    table.Row(rows.At(index), cells[:], false)
}
table.Footer([]string{"Total", "3 items", "¥ 4,540"})
table.Caption("Click any data row to see its interactive feedback.")

Selection#

Table selection example rendered by the production Go component.

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

Usage
rows := tree.Sub(page, tree.Name("row"))
table := components.BeginTable(canvas, theme, bounds, columns)
table.Header([]string{"Item", "Status", "Amount"})
for index, cells := range bills {
    selected := flags&(1<<index) != 0
    if table.RowAt(rows, index, cells[:], selected) {
        flags ^= 1 << index
    }
}
table.Footer([]string{"Total", "3 items", "¥ 4,540"})

Alignment#

Table alignment example rendered by the production Go component.

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

Usage
columns := []components.TableColumn{
    {Width: 112, Alignment: components.TableAlignLeft},
    {Width: 88, Alignment: components.TableAlignCenter},
    {Alignment: components.TableAlignRight},
}
table := components.BeginTable(canvas, theme, bounds, columns)
table.Header([]string{"Item", "Status", "Amount"})
for _, cells := range bills {
    table.Row(ui.ID{}, cells[:], false)
}
table.Caption("Item is left-aligned, status centered, amount right-aligned.")

Overflow#

Table overflow example rendered by the production Go component.

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

Usage
columns := []components.TableColumn{{Width: 96}, {Width: 40}, {Alignment: components.TableAlignRight}}
headings := []string{"Item", "Status", "Amount"}
components.FitTableHeadings(canvas, theme, columns, headings)
table := components.BeginTable(canvas, theme, bounds, columns)
table.Header(headings)
for _, cells := range bills {
    table.Row(ui.ID{}, cells[:], false)
}
table.Caption("Item is cut with an ellipsis; Status grew to hold its heading.")

Installation

Copy the recipe into your own project.

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

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.