Adding HTML id attribute to Nav Items, RelationManager Tabs, etc.

How can I add custom html attributes (especially id) to Filament components like Nav Item, RelationManager tab, etc. ? I know for Form Components there is https://filamentphp.com/docs/3.x/forms/layout/getting-started#adding-extra-html-attributes Thanks
9 Replies
toeknee
toeknee5w ago
Yeah it's not possible at the moment unforetunately as far as I can see. You should be able to targer the element still though, waht are you trying to use ID for?
Patrick
PatrickOP5w ago
Thanks @toeknee for your fast reply. I need to implement a User onbaording tool which could work for class selectors, but this will be a pain in the future. So I want to assign ID's to specific elements to make sure the target does not change
toeknee
toeknee5w ago
Is the class selector a query selector? If so you should be able to target it with the. the href attribute
Patrick
PatrickOP5w ago
It's Usetiful. They are using attribute selectors or tag, css
Patrick
PatrickOP5w ago
No description
toeknee
toeknee5w ago
Actually you can do NavigatiomnGroup? Then nth-child them?
Patrick
PatrickOP5w ago
Thanks for the suggestion, I don't think it's working for our case. Our ProductOwner creates the Usetiful tours without the need of communication to our dev team. So whenever the dev team changes the navigation structure or tab structure or any non ID related stuff, the selector would be wrong/broken. Or do I miss sth? We need to make sure the Usetiful selector is unique and stays the same regardless of the classes, order, structure, etc.
toeknee
toeknee5w ago
No problem, then I can’t see how you could do it. I would suggest looking to do a PR to allow you to add extra attributes to navigation items

Did you find this page helpful?