© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
tom hatzer

Lazy loading for Select form component options

Hey there!

Is anyone aware of a way to lazy load the options of a Select form component?

Right now I've added the Select dropdown to a table action modal window. The request for the options is done while loading the table which is sub-optimal as it will fire 25 requests (current items per page set to 25) during the initial load and on every page switch.

I'd love to load the options for the Select component only right before it's being displayed to the user (eg. after clicking on the action button for the record and when the modal window is shown).

Thank you very much!

Best wishes
Tom
Solution
I think I found a way... (the returned array is the replacement for a method call that I have in my code, to simplify things)

Specifying the options using an inline function callback triggers the callback immediately:
->options(fn():array => ['1', '2', '3'])
->options(fn():array => ['1', '2', '3'])


Specifying the options using a regular function definition only triggers the call when the modal is opened and the Select component is shown
->options(function() {
    return ['1', '2', '3'];
})
->options(function() {
    return ['1', '2', '3'];
})
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Select Component Lazy Loading though API
FilamentFFilament / ❓┊help
2y ago
Form Select component select all options method
FilamentFFilament / ❓┊help
3y ago
select filter lazy loading
FilamentFFilament / ❓┊help
2y ago
Lazy loading Select ->preload()
FilamentFFilament / ❓┊help
3y ago