Table Builder Engine (pkg/tables)
Column Types Reference#
res.Table(func(table *tables.Table[*Product]) *tables.Table[*Product] {
return table.
Columns(
// 1. Text Column
tables.TextColumn[*Product]("title").
Label("Product Name").
Sortable().
Searchable().
Weight("bold").
Copyable(),
// 2. Formatted Money Text Column
tables.TextColumn[*Product]("price").
Label("Price").
Sortable().
Money("USD").
Align("right"),
// 3. Status Badge Column
tables.BadgeColumn[*Product]("status").
Label("Status").
Sortable().
Colors(map[string]string{
"published": "success",
"draft": "warning",
"archived": "gray",
}),
// 4. Boolean Icon Column
tables.IconColumn[*Product]("is_featured").
Label("Featured").
Boolean(),
// 5. Interactive Inline Toggle Column
tables.ToggleColumn[*Product]("is_published").
Label("Storefront Active"),
// 6. Interactive Inline Select Column
tables.SelectColumn[*Product]("status").
Label("Quick Status").
Options(map[string]string{
"draft": "Draft",
"published": "Published",
"archived": "Archived",
}),
// 7. Interactive Inline Text Column
tables.TextInputColumn[*Product]("stock").
Label("Live Stock"),
// 8. Image Column
tables.ImageColumn[*Product]("thumbnail").
Label("Preview").
Circular().
Size(40),
)
})
Column Controls, Resizing, Sorting & Toggling#
Columns can be configured with fine-grained visibility defaults:
tables.TextColumn[*Product]("sku").
Toggleable(). // User can show/hide via column picker
ToggledHiddenByDefault(). // Initially hidden
Sortable(). // Click header to sort ASC/DESC
Searchable(). // Included in quick table search
AdvancedSearchable() // Included in refined facet filters
Filter Suite#
table.Filters(
// Select filter
tables.SelectFilter[*Product]("status").
Label("Fulfillment Status").
Options(map[string]string{
"pending": "Pending Processing",
"shipped": "Shipped",
"delivered": "Delivered",
}),
// Boolean Ternary filter
tables.TernaryFilter[*Product]("is_published").
Label("Storefront Visibility").
TrueLabel("Published Only").
FalseLabel("Drafts Only"),
// Automatic 3-state Trashed filter (injected automatically when SoftDeletes is enabled)
tables.TrashedFilter[*Product](),
)
Refined Search Engine with Dynamic Facet Counts#
Columns marked with .RefinedFilter() automatically expose dynamic facet count chips: e.g. [x] Electronics (42), [ ] Apparel (18).
Table Actions & Bulk Operations#
table.
// Row Actions
Actions(
tables.ViewAction[*Product](),
tables.EditAction[*Product](),
tables.DeleteAction[*Product](),
// Custom Action with Modal Form
tables.NewAction[*Product]("apply_discount").
Label("Apply Discount").
Icon("tag").
Color("warning").
RequiresConfirmation().
Form(forms.New().Schema(
forms.TextInput("percentage").Numeric().Required().Suffix("%"),
)).
Action(func(ctx *filament.Context, record *Product, data map[string]any) error {
return applyDiscount(record.ID, data["percentage"])
}),
).
// Bulk Operations
BulkActions(
tables.DeleteBulkAction[*Product](),
tables.NewBulkAction[*Product]("publish_all").
Label("Publish Selected").
Icon("check-circle").
Action(func(ctx *filament.Context, ids []string) error {
return publishBatch(ids)
}),
)
Streaming CSV Data Export & Import#
Resources support high-performance streaming export:
- Export: Triggered via
tables.ExportAction()orGET /admin/api/resources/{slug}/export?format=csv. Streams directly to client with memory efficiency. - Import:
res.InvokeImportCSV(ctx, reader, fieldMapping)with automatic schema validation and batch ingestion.