Skip to content

Table Cell

A table cell holds the content of one cell in a table row. It can span several columns or rows, and set its own alignment, background, padding, border and click action. The Table page describes the table itself.

Table

return Table(
	TableColumn(Text("Name")),
	TableColumn(Text("Role")).Width(L160),
	TableColumn(Text("Status")).Alignment(Trailing),
).Rows(
	TableRow(
		TableCell(Text("Ada")),
		TableCell(Text("Admin")),
		TableCell(Text("active")),
	),
	TableRow(
		TableCell(Text("Linus")),
		TableCell(Text("Editor")),
		TableCell(Text("invited")).BackgroundColor("#FDE2C4"),
	).HoveredBackgroundColor(ColorCardFooter),
	TableRow(
		TableCell(Text("Grace: ColSpan(2)")).ColSpan(2),
		TableCell(Text("active")),
	).BackgroundColor("#C9E7F8"),
).Frame(Frame{Width: L560})

Constructors

ConstructorDescription
TableCell(content core.View) TTableCellCreates a new table cell with the given content.

Methods

MethodDescription
Action(action func()) TTableCellSets an optional click/tap action for the cell.
Alignment(alignment Alignment) TTableCellSets the alignment for the cell content.
BackgroundColor(backgroundColor Color) TTableCellSets the background color of the cell.
Border(border Border) TTableCellSets the border of the cell.
ColSpan(colSpan int) TTableCellSets how many columns this cell spans.
Content(content core.View) TTableCellReplaces the content of the cell.
HoveredBackgroundColor(backgroundColor Color) TTableCellSets the background color when the cell is hovered.
Key(name, id string) TTableCellIdentifies the action across renders by what it acts on, e.g. (column, rowID).
Padding(padding Padding) TTableCellSets the padding of the cell.
RowSpan(rowSpan int) TTableCellSets how many rows this cell spans.

Related