outer-web / filament-image-library

MIT License
20 stars 4 forks source link

How to set limit for ImageLibraryPicker, when multiple mode is enabled? #7

Open Nuhel opened 3 months ago

Nuhel commented 3 months ago

ImageLibraryPicker::make('images') ->label('') ->multiple(true) ->required()

How to set max limit for this?

SimonBroekaert commented 3 months ago

Hi @Nuhel ,

You can use

ImageLibraryPicker::make('images')
->label('')
->multiple()
->rules('array|max:5')
->required()

This wil validate the array.

I will look into a better UX experience in a future update where the user will not be able to select more items if the limit has been reached. I will than add a message or a counter to notify the user about the max selection.