F
Filamentβ€’9mo ago
Laurens

Overwrite table widget label

This is probably something super obvious I'm missing... but how do you change the label of a Filament table widget? πŸ€” I've looked a bit around in the docs and properties but couldn't see a direct change. Since we usually suffix our class names (ex. TableWidget for Filament table widgets) I'd like to remove the table part. We'll eventually also need to translate the widget title. Thanks in advance!
2 Replies
Jo
Joβ€’9mo ago
By label, do you mean the heading of the table? If so, it's just this at the top of your table widget file:
protected static ?string $heading = 'Custom Heading';
protected static ?string $heading = 'Custom Heading';
To make it translatable you'll have to define it as a method though:
protected function getTableHeading(): string
{
return __('Translatable Custom Heading');
}
protected function getTableHeading(): string
{
return __('Translatable Custom Heading');
}
Laurens
LaurensOPβ€’9mo ago
That's it! perfect thanks πŸ™‚
Want results from more Discord servers?
Add your server