Tables
Build a server-driven table: columns, sorting, search, filters, tabs, pagination, polling, row and bulk actions, column summaries, CSV and XLSX export, and drag reordering.
A table is a block you add to a page with $s->table('name'). It needs two things: columns() to say what each row shows, and query() to say where the rows come from. Everything else — sorting, search, filters, tabs, actions — is opt-in.
The table never ships its rows with the page. The browser fetches them from a page-scoped endpoint, and every sort, search, filter and page change is a new request that re-runs your query() closure on the server. The name you give the table is how actions and effects refer to it, so keep it unique on the page. A page can hold any number of tables, next to forms, stats and other blocks; see Composing a page.
The full method lists are in the Tables API reference: TableBuilder, Column and Tab.
A minimal table
namespace App\Admin\Pages;
use App\Models\Product;
use Tbtop\Admin\Dsl\Color;
use Tbtop\Admin\Dsl\Column;
use Tbtop\Admin\Dsl\Node;
use Tbtop\Admin\Dsl\S;
use Tbtop\Admin\Pages\Page;
class ProductsIndexPage extends Page
{
public static function path(): string
{
return 'products';
}
public function view(S $s): Node
{
return $s->table('products')
->query(fn () => Product::query()->with('category'))
->columns([
Column::make('name')->label('Name')->sortable()->searchable(),
Column::make('category.name')->label('Category'),
Column::make('price_cents')->label('Price')->money('USD')->align('right'),
Column::make('status')->badge([
'draft' => ['label' => 'Draft', 'color' => Color::Gray],
'live' => ['label' => 'Live', 'color' => Color::Success],
]),
Column::make('updated_at')->label('Updated')->date('Y-m-d')->sortable(),
])
->defaultSort('updated_at', 'desc')
->toNode();
}
}query() must return a fresh builder on every call — it runs once for the rows and again for each tab count. Returning Product::query() from the closure does that; capturing one builder instance outside the closure does not.
Columns
Column::make('name') reads the attribute of the same name from each row. The label defaults to the humanized name. A quick table can also pass ['sku' => 'SKU', 'name' => 'Name'] to columns().
Relation columns. A dotted name such as category.name reads through a loaded relation. Eager-load it in query(). Search runs as SQL on the column name, so searchable() on a dotted column fails at query time. Sorting is handled separately — see Sorting.
Display kinds. One kind method decides how a cell renders:
| Method | Renders |
|---|---|
date(), datetime(), time() | a formatted date or time, Y-m-d / Y-m-d H:i:s / H:i by default |
number($decimals) | a formatted number |
money('USD') | an amount stored in minor units: 1999 renders as 19.99 USD |
badge([...]) | a colored badge, its text and color chosen by value — see Badges |
boolean() | a check or cross icon |
iconMap([...]) | an icon chosen by value |
image() | a thumbnail; shape with square(), rounded() or circular() |
color() | a color swatch |
link(fn ($row) => ...) | a link to the URL the closure returns |
Kind methods are exclusive: chaining two keeps only the last. Formatting happens on the server, so date() and money() are applied before the value reaches the browser. formatUsing(fn ($value, $row) => ...) replaces the kind's formatting entirely — it does not layer on top.
Visibility. hidden() drops the column from the table: it is not rendered, not projected, not sent and cannot be edited inline. visible(fn () => ...) makes that decision per request. A column dropped either way is also left out of the table search, per-column search and sort, so ?search= and ?sort= cannot probe it; to search a field you do not show, name it in the table-level searchable(['email', ...]), which takes field names and needs no column. That list is not gated by visible(), so name there only fields every user of the table may search. A row carries an allowlist, never the full database row: the record key (under its own name and again as _key), the visible declared columns, the groups() column and the row meta (_recordUrl, tooltips, descriptions). Undeclared attributes and eager-loaded relations stay on the server. So a row-action URL template, a row-action hiddenIf() / disabledIf() or a needs: ['row'] handler sees only those fields: declare a column for anything else, or load the record by $ctx->key() in the handler. toggleable() ships the column and lets the user hide it from the column menu; toggleable(true, true) starts it hidden.
Counting a relation. There is no counts() column method. The table runs your Eloquent query, so add the count there with withCount() and show the {relation}_count attribute it adds as a plain column:
$s->table('categories')
->query(fn () => Category::query()->withCount('posts'))
->columns([
Column::make('name')->label('Name')->sortable(),
Column::make('posts_count')->label('Posts')->align('right')->sortable(),
])sortable() works on the count, since sorting orders by the column name. Do not make it searchable(): search filters on that name in SQL, and posts_count is not a table column. withSum(), withAvg() and withExists() work the same way.
Translatable values. ->translatable() on a column reads a locale map and shows the default content locale, falling back to the first non-empty locale. See translatable fields.
Presentation. align(), width(), wrap(), truncate(), noWrap(), lineClamp(), muted(), description(), tooltip(), prefix()/suffix() and copyable() adjust a cell without changing its value.
Line breaks. A cell wraps by default. Four modes change how; they are mutually exclusive, and the last call wins:
| Method | Cell |
|---|---|
wrap() | wraps onto as many lines as it needs (the default) |
truncate() | one line, cut with an ellipsis |
noWrap() | one line, never cut: the column widens instead |
lineClamp(2) | wraps onto at most 2 lines, with an ellipsis on the last |
Column::make('intro')->label('Intro')->lineClamp(2)->width('320px'),lineClamp() cuts the value only: a description() still shows under it in full. On a group column it applies to each child that sets no line-break mode of its own. The cut text is not repeated on hover, so add tooltip(fn ($row) => …) when the full text matters. Without width() the column may get enough room that it never reaches the limit. lineClamp(0) throws InvalidArgumentException.
Grouped columns. group([...]) stacks several columns under one header and in one cell:
Column::make('product')->label('Product')->group([
Column::make('name')->label('Name')->sortable(),
Column::make('sku')->label('SKU')->searchable(),
]),The group itself is display-only; its children are the real fields. searchable(), sortable() and translatable() go on a child and work as they do on any column. The group's header sorts by its first sortable() child. sortable() and individuallySearchable() on the group throw, and so does individuallySearchable() on a child.
Column order and width. Users arrange the columns themselves. In the Columns menu they drag an entry by its grip, or move it with Alt+↑ and Alt+↓. They resize a column by dragging the right edge of its header; a double-click restores the declared width(). The layout is saved per table in the browser's localStorage, under tbtop:table.<name>.layout.v1, next to the visibility choice. The menu gains a reset entry once anything is customized, and it clears order and widths together.
There is no PHP setting for this: the order in columns() stays the default, and nothing reaches the server. A column you add later goes to the end of a user's saved order, and the leading sticky() columns never move. A table without the Columns menu keeps the declared order: columnToggle(false) tables can still be resized, embedded ones cannot.
Sticky columns
A wide table scrolls sideways inside its frame. sticky() pins a column to the left edge, so the row stays identifiable while the rest slides under it:
->columns([
Column::make('number')->label('Order')->sticky(),
Column::make('customer.name')->label('Customer')->sticky(),
Column::make('total_cents')->label('Total')->money('EUR'),
// … more columns than the screen fits
])- Sticky columns must come first in
columns(). A sticky column after a scrolling one throwsInvalidArgumentException, since it would slide over its neighbour. Several sticky columns stack left to right. - On a grouped column, call
sticky()on the group. A sticky child throws. - The row checkbox for bulk actions and the drag-reorder handle are pinned with them. Row actions scroll.
- Offsets are measured from the rendered header, so
width()is not required. A wide sticky column eats the scroll area, so keep it narrow withwidth()ortruncate().
Badges
badge() maps the stored value to a label and a color. It takes an inline map or an enum class:
// inline map: both keys are optional
Column::make('status')->badge([
'pending' => ['label' => __('Pending'), 'color' => Color::Warning],
'paid' => ['label' => __('Paid'), 'color' => Color::Success],
'refunded' => ['label' => __('Refunded')],
]),
// an enum class
Column::make('status')->badge(OrderStatus::class),The enum form reads HasLabel and HasColor from Tbtop\Admin\Contracts. Their signatures match Filament 4's, so a Filament enum ports by swapping its use lines. Cases are keyed by ->value, or ->name for a pure enum; a case without a label shows its name.
use Tbtop\Admin\Contracts\HasColor;
use Tbtop\Admin\Contracts\HasLabel;
use Tbtop\Admin\Dsl\Color;
enum OrderStatus: string implements HasLabel, HasColor
{
case Pending = 'pending';
case Paid = 'paid';
public function getLabel(): ?string
{
return __(ucfirst($this->value));
}
public function getColor(): Color
{
return $this === self::Paid ? Color::Success : Color::Warning;
}
}A value missing from the map renders as stored, in gray. Keys must match what the row serializes to: a boolean cast arrives as true/false, so map a computed value with formatUsing() instead. displayValue()->badge() takes the same two forms. An array color, such as a Filament palette, throws: the client knows color names only.
Deprecated in v0.5.5
The color-only map badge(['paid' => Color::Success]) still works but raises an E_USER_DEPRECATED and is removed in 1.0. Write ['paid' => ['color' => Color::Success]].
Sorting
A column is sortable only if you say so with sortable(). The sort parameter in the request is checked against that list, so a user cannot sort by an arbitrary column. defaultSort('field', 'desc') sets the order used when the request carries none; the default field is always allowed.
When the value to sort by is not the column's own name, redirect the sort:
// full_name is an accessor; sort by the real column instead
Column::make('full_name')->label('Name')
->sortable()
->sortBy('last_name'),
// a related value, sorted through the customer() relation
Column::make('customer.name')->label('Customer')
->sortable(),
Column::make('total_cents')->label('Total')->money('USD')
->sortable()
->sortUsing(fn ($query, string $direction) => $query->orderByRaw(
'total_cents - discount_cents '.$direction
)),sortBy() names another field to order by. A dotted sort target whose first segment is a relation method on the model — a sortable customer.name column, or sortBy('customer.name') — is ordered through a correlated subquery rather than a join; a to-many relation sorts by its first related row. This needs an Eloquent query(). sortUsing() gives you the query and a direction already validated to asc or desc; it wins over sortBy().
In a grouped column, mark a child sortable(); the group's header then sorts by the first sortable child.
Search
There are two kinds of search, and they combine.
Global search is the single search box in the toolbar. It matches any of the searchable fields: every Column::searchable() column plus the field names you pass to the table's searchable([...]). Those names do not have to be visible columns.
$s->table('customers')
->columns([
Column::make('name')->searchable(),
Column::make('email'),
])
->searchable(['email', 'phone']) // searches name OR email OR phone
->searchPlaceholder('Name, email or phone')Per-column search adds a search input to a column's header with individuallySearchable(). Each per-column box narrows the result on its own, so two filled boxes both have to match.
Both run LIKE '%term%' on the named database column. That has two consequences: a dotted relation column cannot be searched this way, and a translatable column stored as JSON is matched against its raw JSON text, not against one locale.
Filters
Filters reuse form fields. Declare them with filters():
use Tbtop\Admin\Dsl\Fields\Boolean;
use Tbtop\Admin\Dsl\Fields\Daterange;
use Tbtop\Admin\Dsl\Fields\InFilter;
use Tbtop\Admin\Dsl\Fields\Select;
->filters([
InFilter::make('status')->label('Status')->options([
['value' => 'pending', 'label' => 'Pending'],
['value' => 'paid', 'label' => 'Paid'],
['value' => 'refunded', 'label' => 'Refunded'],
]),
Select::make('warehouse_id')->label('Warehouse')->options($warehouseOptions),
Daterange::make('shipped_on')->label('Shipped'),
Boolean::make('overdue')->label('Overdue only')
->filterUsing(fn ($query, $value) => $query->when(
filter_var($value, FILTER_VALIDATE_BOOLEAN),
fn ($q) => $q->where('due_on', '<', now()->toDateString())->whereNull('paid_at'),
)),
])
->filtersIn('modal')
->deferFilters()
->filtersFormColumns(2)Each filter narrows the query by its own field name, using a mapping chosen by the field kind:
| Filter kind | Query applied |
|---|---|
select, radio, number, date, datetime, time | where(name, value) |
text, textarea, slug, password | where(name, 'like', '%value%') |
boolean | where(name, true/false) |
inFilter, tags | whereIn(name, values) |
daterange | >= from and <= to, each end optional |
anything else, such as relation | throws — add filterUsing() |
filterUsing(fn ($query, $value) => ...) replaces the default mapping. Use it whenever the filter name is not a column on the table's model: a virtual flag like overdue above, a condition on a relation with whereHas(), or a date range over a datetime column. The default daterange compares against the bare day, so on a timestamp column the last day is cut off at midnight; whereDate() inside filterUsing() avoids that. An empty value never reaches the query. For a yes / no / any choice on a boolean, use Radio::make('is_published')->ternary(); see Yes / no / any filter.
filtersIn() picks one of three layouts, and any other value throws:
'modal'(the default): a Filters button opens a dialog, shaped byfiltersFormColumns()andfiltersFormWidth().'inline': the fields sit in the toolbar row;filtersFormColumns()puts them on a grid.'aside': a panel left of the table, one field per row, with a Filters button in the toolbar that hides and shows it. Each user's choice is remembered per table in the browser;filtersCollapsed()sets only the first-visit default. Below thelgbreakpoint the button opens the same fields in a side sheet instead.
$s->table('orders')
->filters([$s->select('status')->options(OrderStatus::class)])
->filtersIn('aside')
->filtersCollapsed();Active-filter chips. Every applied filter shows as a chip under the toolbar, such as Status: Published, Draft, with a × that drops that one filter. Two or more chips add a "Clear filters" link that drops them all and keeps the search. There is no PHP API: a chip reads the filter's label() plus its value, with option labels for select, in and radio filters, formatted dates and ranges, and the label alone for a boolean that is on. With deferFilters() a chip appears only after Apply. An embedded() table shows no chips.
deferFilters() waits for an explicit Apply before narrowing the query. Only declared filters are applied: a table without filters() ignores filter parameters in the request.
Tabs
Tabs are predefined scopes above the table, not the layout tabs from $s->tabs():
use Tbtop\Admin\Dsl\Tab;
->tabs([
Tab::make('all')->label('All'),
Tab::make('open')->label('Open')
->query(fn ($q) => $q->whereNull('closed_at'))
->count(),
Tab::make('closed')->label('Closed')
->query(fn ($q) => $q->whereNotNull('closed_at')),
])A tab's query() narrows the table's builder in place and runs before search, filters and sort. The first tab is the default. count() adds a badge with the number of rows in the tab, at the cost of one count query per tab per request; the badge ignores the current search and filters.
Pagination
Pagination is always on. paginate(25, [10, 25, 50, 100]) sets the default page size and the sizes the user can pick — those are also the defaults. A requested page size outside the list falls back to the default.
Simple pagination. On a large or heavily joined table the count() query is the slow one. simplePagination() skips it:
$s->table('events')
->paginate(50, [50, 100])
->simplePagination()The page query reads one row more than the page size, only to learn whether there is a next page. The footer shows previous, "Page N", next and the page-size selector, without the "1–25 of 1,000" range or page numbers, and it hides on a first page with no next one. Search, filters, sort, tabs and URL state work as before. A tab with count() still runs its own count query for its badge, so drop count() from those tabs if the point is to avoid counting. Cursor pagination is not offered.
A custom client that reads the table endpoint directly gets hasMore (a boolean) in place of total from such a table.
Rows and actions
Row links. recordUrl(fn ($row) => "/admin/orders/{$row->id}") makes each row a link; the closure receives the model. rowClick('edit') instead makes a row click fire the row action named edit.
Actions. A table carries three action slots:
->headerActions([ /* above the table, e.g. a Create button */ ])
->rowActions([ /* per row; the handler gets the row */ ])
->bulkActions([ /* shown once rows are checked; the handler gets the keys */ ])use Tbtop\Admin\Actions\ActionCtx;
use Tbtop\Admin\Actions\Effects;
use Tbtop\Admin\Dsl\Actions\DeleteAction;
->rowActions([
$s->action('open')->label('Open')->url('/admin/orders/{row.id}'),
DeleteAction::make($s, using: function (ActionCtx $ctx): void {
Order::whereKey($ctx->key())->delete();
}),
])
->bulkActions([
$s->action('mark-paid')->label('Mark paid')
->confirm('Mark the selected orders as paid?')
->handle(function (ActionCtx $ctx): Effects {
$count = Order::whereKey($ctx->selection)->update(['paid_at' => now()]);
return Effects::make()->notify("{$count} order(s) marked paid")->refreshTable('orders');
}, needs: ['selection']),
])The selection holds the checked rows; it is cleared whenever the rows change — a new page, a filter, a refresh.
All matching rows. Once every row on the page is checked and the table has more, the bulk bar offers "Select all 1240". Picked, the next bulk action runs on every row that the table's tab, search, column search and filters match, not just the page. There is nothing to opt into: $ctx->selection then holds every matching key, so a whereKey($ctx->selection) handler like the one above keeps working, and $ctx->allMatching tells the two cases apart. For a large table, use $ctx->records(), the table's own query narrowed to the selection, so the work runs as one statement instead of a key list:
->bulkActions([
$s->action('archive')->label('Archive')
->handle(function (ActionCtx $ctx): Effects {
$count = $ctx->records()->update(['archived_at' => now()]);
return Effects::make()->notify("Archived {$count} order(s)")->refreshTable('orders');
}, needs: ['selection']),
])- Existing bulk actions, delete included, now reach every matching row after "Select all". If a destructive handler should stay limited to the page, check
$ctx->allMatchingand refuse or narrow it there. records()works only for an action in the table'sbulkActions(), including groups, dropdowns and a bulk modal's submit. Anywhere else it throws.- If a handler needs both the keys and a write through
records(), read$ctx->selectionfirst. The keys are read lazily with the table's filters, so after the write moves rows out of the tab or filter, a later read misses them. - The offer needs a row total, so a
simplePagination()orembedded()table never shows it. - Node:
ctx.records()returns your driver's query andctx.allMatchingthe flag. Handlers, confirmation, modals and effects are covered on Actions.
Inline editing. toggle(), textInput(), numberInput() and selectColumn() make a cell editable. Each needs an onSave closure, which receives the model and the new value:
Column::make('featured')->label('Featured')
->toggle()
->onSave(function (Product $product, bool $value): Effects {
$product->update(['featured' => $value]);
return Effects::make()->notify($value ? 'Featured' : 'Unfeatured');
}),selectColumn() takes its choices from options(), which accepts an option list or an enum class; the cases become {value, label} pairs. Options imply no validation, so add rules([Rule::enum(OrderStatus::class)]).
The model is loaded through the table's own query(), so a row outside that query cannot be edited, and the query must be Eloquent. Add rules() to the column to validate the value before onSave runs. An editable cell shows the raw stored value, so kind formatting does not apply, and formatUsing() on an editable column throws when the page renders; use prefix()/suffix() for units. step() without numberInput() throws too.
Auto-refresh
poll(10) re-fetches the current page of rows every 10 seconds, through the same endpoint and with the user's search, filters, sort, tab and page. It is for lists that change while someone watches them, such as an order queue or an import log:
$s->table('orders')
->query(fn () => Order::query()->latest())
->columns([...])
->poll(10)- Silent. The rows stay on screen with no loading overlay. One failed refresh keeps them and tries again; a second failure in a row shows the table's error state with a retry button, so stale rows never pass for current ones.
- No pile-up. A tick that lands while a slow fetch is still running is skipped, not cancelled.
- Pauses. Polling stops while the browser tab is hidden, with one refresh on return, and while any row is selected, since new rows would clear the selection a bulk action is about to use. An inline cell with an unsaved edit keeps it.
- Floor of 5 seconds. A shorter interval throws.
For a change the page itself makes, the refreshTable effect is still the tool; poll() covers changes made elsewhere.
Summaries
summarize() adds a totals row under the table. Each Summary is an aggregate over every row the filtered query matches, with the current tab, search and filters applied, not just the page:
use Tbtop\Admin\Dsl\Summary;
->columns([
Column::make('total')->money('USD')
->summarize(Summary::sum(), Summary::avg('Average order')),
Column::make('number')->summarize(Summary::count()),
Column::make('margin')->summarize(
Summary::using(fn ($query) => $query->sum('total') - $query->sum('cost'), 'Margin'),
),
])sum(),avg(),min(),max()andcount()each take an optional label. Their values are formatted like the column's cells (money, number, date).count()is an integer, andavg()is rounded to 2 decimals unlessmoney()ornumber($decimals)formats it.using($fn, $label)gets a clone of the filtered query and is shown exactly as it returns.- On a
groups()table, each group also gets a subtotal row over the whole group, which stays visible when the group is collapsed. - A built-in summary throws on a relation path, where you use
using()instead, and on agroup()column. Totals are not part of an export. - Node: the same names,
Column.make("total").summarize(Summary.sum()). Summaries go through the optionalQueryDriver.aggregate(), which the Kysely and in-memory drivers implement.
The full list is under Summary in the API reference.
Export
ExportAction downloads a table's rows as CSV or XLSX. Put it in headerActions() to export the whole table, or in bulkActions() to export the checked rows, with a switch for "all matching rows". A click opens a dialog where the user ticks columns and picks a format; the download then carries the table's current tab, search, column search, filters and sort. The last pick is remembered per table.
use Tbtop\Admin\Dsl\Actions\ExportAction;
use Tbtop\Admin\Dsl\ExportFormat;
$s->table('orders')
->query(fn () => Order::query())
->columns([
Column::make('number')->label('Order'),
Column::make('total')->money('USD')
->export(as: fn ($cents) => $cents / 100), // a number, not "12.50 USD"
Column::make('note')->export(label: 'Internal note', enabled: false),
])
->headerActions([
ExportAction::make($s)->authorize('export-orders'),
])
->bulkActions([
ExportAction::make($s, [ExportFormat::Csv], filename: 'orders', name: 'exportSelected'),
])- Values are what the table shows, in CSV and XLSX alike: formatted dates, numbers and money, badge and select labels, booleans as Yes/No.
export(as: fn ($value, $row) => ...)replaces a column's value in the file;$valueis the raw column value. - Columns.
export(label: ...)renames the header in the file.export(enabled: false)leaves the column unticked in the dialog, and the user can still tick it. A column withoutexport()is ticked when it is visible. - Size. The file streams straight from the query, with no queue.
maxRows(50 000 by default) caps an export: a larger one is refused with a message to narrow it down. Raise it withExportAction::make($s, maxRows: 200_000). - Permission. Who may export is the action's
authorize(). The endpoint answers 404 to anyone else, and to an export action asked for another table's rows. - CSV is UTF-8 with a BOM, so Excel opens it with the right encoding. A text cell that starts with
=,+,-,@, a tab or a carriage return gets a leading', so a spreadsheet does not run it as a formula.
An export is a custom action on the wire, so the MCP server lists it as excluded. ExportAction::make() returns an ActionBuilder like the other action presets; export() is listed with the other Column methods. Import is not available yet.
Reordering
reorderable('sort_order') adds drag handles and makes that column the default sort. On drop, the package checks every id against the table's query() scope and writes each row's new position to the column in one transaction.
That write is a query-builder update(), so Eloquent model events and observers do not fire, and a cache keyed on them goes stale. When your app should own the write, pass it as the second argument:
use Illuminate\Database\Eloquent\Builder;
use Tbtop\Admin\Actions\Effects;
$s->table('pages')
->query(fn () => Page::query())
->reorderable('sort_order', function (array $ids, Builder $query) {
Pages::reorder($ids); // your write: model events, cache flush, audit log
return Effects::make()->refreshTable('pages')->notify('Order saved');
})The closure replaces the package's write and gets the ids in their new order plus a fresh scoped query. The ids are scope-checked before it runs, but no transaction is opened for it. It may return Effects; anything else falls back to refreshing the table.
More table features
- Grouping.
groups('status')puts a header row above each run of rows sharing a value. It requiresdefaultSort('status', ...)first, groups only within the current page, and is off while reordering.groups('status', collapsible: true)turns each header into a toggle that hides or shows its group, andcollapsed: truestarts every group closed (it impliescollapsible). The open or closed state survives a refetch, poll or page change, and each user's choice is remembered per table in the browser, so a reload keeps it;collapsed: trueonly sets the default for groups the user has never toggled. - Soft deletes.
softDeletes($s, Order::class)adds Active / Trashed / All tabs and restore and force-delete row and bulk actions. Call it after your owntabs(),rowActions()andbulkActions(); it merges into them. The three tabs are prepended, so Active becomes the default tab instead of your first one. Pass['tabs' => false],['rowActions' => false]or['bulkActions' => false]as the third argument to skip a part. - Embedding.
embedded()drops the toolbar, filters and pagination footer, for a small table inside a card.toolbar(false),searchInput(false)andcolumnToggle(false)hide less. - Empty state.
emptyState('No orders yet', 'Orders appear here once a customer checks out.', 'package')replaces the default message. - Several tables per page. There is no limit of one table per page. Each table has its own name, query, endpoint and URL state (
t[name][…]), so tables do not interfere with each other — for example the related rows under a record's edit form. Composing a page has a full example.
Gotchas
money()expects minor units. Store 1999, not 19.99. For a decimal column, usenumber(2)and asuffix().- Toggleable columns still ship.
toggleable(true, true)only starts a column hidden in the menu; its value is in every row.hidden()andvisible(false)keep it on the server. Re-read anything you authorize on from the record, since$ctx->rowcomes from the client. filterUsing()receives the raw query-string value. The kind's casting applies only to the default mapping, so a boolean filter's closure can get the string"false", which is truthy. Cast it yourself, for example withfilter_var($value, FILTER_VALIDATE_BOOLEAN).- Row values come from the browser. In a row action,
$ctx->rowis the row as the client sent it. Look the record up by its key and check access there; do not trust other fields in it. refreshTable()with no name refreshes the table the action sits in, or every table on the page when it is outside one. Name the table when an action on one table should refresh another.
See it in the demo: the posts table combines tabs, modal filters, grouping, per-column search, an inline toggle, row and bulk actions and a slide-over create form. Reorderable posts shows drag reordering, and Soft deletes shows the soft-delete tabs and actions.
Forms
Building a form with $s->form(), seeding it with record(), validating with Laravel rules, saving in onSubmit, and making it dynamic with conditions, dependent fields and server-rendered live regions.
Actions
Buttons that navigate, submit or run a server closure — as page, row and bulk actions, with confirmations, modals, slide-overs and the effects they send back.