Limit number of items in TagsInput
Is there a way to limit the number of items on the TagsInput
5 Replies
any advice on this please?
Hey @Abishek . You can maybe check how many tags you have in the field by using
Filament\Forms\Get
.
For example:
You can have a afterStateUpdated()
on your TagsInput
and then use Filament\Forms\Get
to get the contents of the field. Then you can validate it however you want and inject the TagsInput
again in the callback and then update it to have a info displayed above the field saying something like Only 2 tags allowed
or something like that.ok, let me try that. was hoping something similar like a method I may be missing to limit the number of items on the control.
I checked the docs and I dont think there is a function like
->max()
Something like this