How to change the Builder Block Item Label?
Hello, I was looking for a solution all week, unfortunately without success, I want to change the builder block item label (for example: item 1, item 2, ...). I would like to use the name of the text input inside the item. Is this possible? Any tips or ideas?
17 Replies
There should be an
itemLabel()
methodThere is a regular label() but how to edit inside a afterStateUpdated for example?
It should be on the block level
I dont want to use the position (item 1, item 2 etc..) I want to use a TextInput value
I understand.
See my answers above
found it, solved with >itemLabel(fn (array $state): ?string => $state['name'] ?? null),
Sorry for confusing, reapter with itemLabel works great, but inside a block i got the following info, that itemLabel not exist:
Method Filament\Forms\Components\Builder\Block::itemLabel does not exist
any other solution?
Why?
see above, itemLabel not exist inside block component?
Sorry, that message didn't show up on my Discord. π
Hm, I thought we have it for Blocks, too. Probably not possible yet
Solution
Oh wait: You can use
->label(fn () =>)
Maybe a v3 feature?
No need for an itemLabel?
i try it out
Ah, but that would also change the label for the dropdown selection π€
Works inside label function, perfekt! Thanks a lot. Is it possible to remove the position number after the label string?
Probably not. Only via CSS?
No probelm π CSS is also possible. Thanks!