F
Filament2y ago
Abi

Limit number of items in TagsInput

Is there a way to limit the number of items on the TagsInput
5 Replies
Abi
AbiOP2y ago
any advice on this please?
K R A T O S
K R A T O S2y ago
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.
Abi
AbiOP2y ago
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.
K R A T O S
K R A T O S2y ago
I checked the docs and I dont think there is a function like ->max()
K R A T O S
K R A T O S2y ago
Something like this

Did you find this page helpful?