From caba01a7c1ae5bbf591e6f6bb8f50e01c250dea0 Mon Sep 17 00:00:00 2001 From: Mo Khosh Date: Tue, 5 Dec 2023 11:27:31 +0330 Subject: [PATCH] document how you can change table heading and header --- packages/tables/docs/02-getting-started.md | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/tables/docs/02-getting-started.md b/packages/tables/docs/02-getting-started.md index cff973d51d..64d1413d29 100644 --- a/packages/tables/docs/02-getting-started.md +++ b/packages/tables/docs/02-getting-started.md @@ -165,6 +165,38 @@ We also define a bulk action. When bulk actions are defined, each row in the tab Actions can also open modals to request confirmation from the user, as well as render forms inside to collect extra data. It's a good idea to read the [Actions documentation](../actions/overview) to learn more about their extensive capabilities throughout Filament. +## Changing the table heading + +The table heading is derived from the model's name by default. If you need to change the table heading you can use the `heading` method on the table to pass a `string`, or an `Htmlable`, or a `Closure` that returns either of these. + +```php +use Filament\Tables\Table; + +public function table(Table $table): Table +{ + return $table + ->heading('Clients') + ->columns([ + // ... + ]); +``` + +You can also pass a full view to the `header` method, which will replace the whole header, not just the heading label. + +```php +use Filament\Tables\Table; + +public function table(Table $table): Table +{ + return $table + ->header(view('partials.table-header', [ + 'heading' => 'Clients', + ])) + ->columns([ + // ... + ]); +``` + ## Next steps with the Table Builder package Now you've finished reading this guide, where to next? Here are some suggestions: