Closed schellmax closed 3 years ago
Thanks @schellmax ,
When BalmUI is 6.x, I use <label>
tag for floating label, then modify it to <span>
tag according to the official document.
I also think it is better to use <label>
, and I will improve it as soon as possible :)
Hi @schellmax ,
It's improved.
balm-ui@8.7.3
for vue2balm-ui@9.1.0
for vue3Thanks again :)
nice!
As mentioned in the docs at https://material.balmjs.com/#/data-input/textfield Textfield labels are passed through the default slot:
<ui-textfield>Label Text</ui-textfield>
and end up in the rendered HTML wrapped in a 'span' tag:
<span class="mdc-floating-label">Label Text</span>
In the original Material Design Component at https://material-components.github.io/material-components-web-catalog/#/component/text-field the appropriate 'label' element is used instead:
<label for="text-field-hero-input" class="mdc-floating-label">Name</label>
There is also a 'label' prop mentioned in the docs, but it seems not to be used by the component.
Label elements are critical for accessibility and should therefore be used for every form input. Balm UI already uses label elements e.g. for checkbox components; usage in Textfields would be highly appreciated.