Table
Bounded tabular data: muted header, hairline rows, widget cells.
For the comparison-shaped data a screen actually shows. Cells are arbitrary
widgets (Table) or plain strings (TableText); column weights via
Widths. Long collections belong in ListView.
Installation
Use the module import (the default), or own the source: lotusui add
vendors the component into your app and lotusui update keeps the copy mergeable —
see Registry.
go get github.com/ikaito-com/lotusui
# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add table
Usage
lotusui.TableText(th, lotusui.TableOpts{
Caption: "A list of recent invoices.",
Footer: []string{"Total", "", "", "$750.00"},
},
[]string{"Invoice", "Status", "Method", "Amount"},
[][]string{
{"INV-001", "Paid", "Credit card", "$250.00"},
{"INV-002", "Pending", "Transfer", "$150.00"},
})
Actions
A quiet menu per row — a ghost trigger aligned to the row's end, its panel end-aligned so it stays on screen.
menu.Variant = lotusui.ButtonGhost
menu.Align = lotusui.PopoverEnd
menu.Layout(th, gtx, "⋯",
lotusui.DropdownMenuItem(th, &edit, "Edit", false),
lotusui.DropdownMenuItem(th, &dup, "Duplicate", false),
lotusui.DropdownMenuSeparator(th),
lotusui.DropdownMenuItem(th, &del, "Delete", true),
)
API
| Option | Type | Description |
|---|---|---|
Widths | []float32 | Per-column flex weights; nil = equal. |
Footer | []string | A final emphasized row (totals) above the caption. |
Caption | string | Muted caption under the table. |