DEV Community

loading...

Discussion on: The what, why and how behind labels

Collapse
beingfrankly profile image
Frank van Eldijk-Smeding Author • Edited

Hi peetboy,

Thanks for replying! I'm curious about a couple things and since I want to learn I hope you can help me out here. Could you tell me more about which framework you're using? And what do you usually do with repeating components? Do you use the implicit approach of using labels? And what part do you dislike about the binding of id prop?

I think that using the index combined with a certain prefix would be a solid solution to get a unique ID for the input and label, so you should be able to go with the explicit approach :-)

Collapse
peetboy profile image
peetboy

Hi Frank,
we are using Vue + BootstrapVue and the most use cases with repeated components are UI forms (banking sector, regulatory forms) where user wants to see all data on the screen. We have created own input components (or I would say wrappers around bootstrap components) and the labels were with explicit approach hence yes, we had to combine index with the ID to get unique identifiers. This of course added a complexity (although small) on other places which we did not expect. But still it doesn't look OK to me that we have to generate IDs just because of label or otherwise we would not need them. There is no need to have ID in Vue app and if you need specifically work with some DOM element, you can use refs instead.