© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
ericlbarnes

"anonymous" actions to a form but only on edit?

I have a form for creating/editing articles. I want to add a "preview" button that just loads the url..

Action::make('preview')
 ->icon('heroicon-o-arrow-top-right-on-square')
 ->color('gray')
 ->url(fn (Set $set, $state): string => $state['slug'] ? route('article.details', ['slug' => $state['slug']]) : '')
Action::make('preview')
 ->icon('heroicon-o-arrow-top-right-on-square')
 ->color('gray')
 ->url(fn (Set $set, $state): string => $state['slug'] ? route('article.details', ['slug' => $state['slug']]) : '')


Is it possible to tell the action to not display if it's on the create page? Or when $state['slug'] is empty?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Use anonymous actions inside a modal form
FilamentFFilament / ❓┊help
2y ago
Form Components only for on form actions
FilamentFFilament / ❓┊help
2y ago
Testting anonymous actions
FilamentFFilament / ❓┊help
2y ago
Filament4 'Adding “anonymous” actions to a form without attaching them to a component'
FilamentFFilament / ❓┊help
6mo ago