Returning Action in renderHook

In v3 you could return an Action::make()->render() in a renderHook but with v4 it complains about the iconPosition not being set (views/components/buttons/index.blade.php:38) I know i could make a livewire component, but for a simple action it seems overkill. Anyone got any ideas how to render an Action in a hook?
->renderHook(PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, function () {
return Action::make('test')
->icon('heroicon-o-plus')
->render();
}
->renderHook(PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE, function () {
return Action::make('test')
->icon('heroicon-o-plus')
->render();
}
6 Replies
toeknee
toeknee4mo ago
What about setting the icon position? I would have thought icon position would have a default though
Andy McOvens
Andy McOvensOP4mo ago
same issue even with iconPosition set, and with ->icon(null)
Dennis Koch
Dennis Koch4mo ago
I guess there is more code to this?
Andy McOvens
Andy McOvensOP4mo ago
no more code to it. just as simple as rendering an action as the result of a renderHook breaks it. created an issue here https://github.com/filamentphp/filament/issues/16571
GitHub
Returning a rendered action in renderHook() shows iconPosition erro...
Package filament/filament Package Version v4 Laravel Version v12 Livewire Version v3 PHP Version 8.3 Breaking change description inside a renderHook, returning an Action with ->render() worked i...
Dennis Koch
Dennis Koch4mo ago
So all you do is render an icon? I don't think you are supposed to call ->render() yourself
Andy McOvens
Andy McOvensOP4mo ago
the code is to render an action button. the idea being it could be a complex action in the example it's just a url i can render it differently if you know of a better way (i presume blade file or livewire component?), but was quite handy to just render an action in a renderHook that worked on v3

Did you find this page helpful?