F
Filamentβ€’2y ago
slamx_

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?
Solution:
Oh wait: You can use ->label(fn () =>)
Jump to solution
17 Replies
Dennis Koch
Dennis Kochβ€’2y ago
There should be an itemLabel() method
slamx_
slamx_OPβ€’2y ago
There is a regular label() but how to edit inside a afterStateUpdated for example?
Dennis Koch
Dennis Kochβ€’2y ago
It should be on the block level
slamx_
slamx_OPβ€’2y ago
I dont want to use the position (item 1, item 2 etc..) I want to use a TextInput value
Dennis Koch
Dennis Kochβ€’2y ago
I understand. See my answers above
slamx_
slamx_OPβ€’2y ago
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?
Dennis Koch
Dennis Kochβ€’2y ago
Why?
slamx_
slamx_OPβ€’2y ago
see above, itemLabel not exist inside block component?
Dennis Koch
Dennis Kochβ€’2y ago
Sorry, that message didn't show up on my Discord. πŸ˜… Hm, I thought we have it for Blocks, too. Probably not possible yet
Solution
Dennis Koch
Dennis Kochβ€’2y ago
Oh wait: You can use ->label(fn () =>)
slamx_
slamx_OPβ€’2y ago
Maybe a v3 feature?
Dennis Koch
Dennis Kochβ€’2y ago
No need for an itemLabel?
slamx_
slamx_OPβ€’2y ago
i try it out
Dennis Koch
Dennis Kochβ€’2y ago
Ah, but that would also change the label for the dropdown selection πŸ€”
slamx_
slamx_OPβ€’2y ago
Works inside label function, perfekt! Thanks a lot. Is it possible to remove the position number after the label string?
Dennis Koch
Dennis Kochβ€’2y ago
Probably not. Only via CSS?
slamx_
slamx_OPβ€’2y ago
No probelm πŸ™‚ CSS is also possible. Thanks!
Want results from more Discord servers?
Add your server