Open rolfsmeds opened 2 years ago
Open question: Should the API for this be a theme variant applied with something like theme="label-aside"
/ *Variant.LUMO_LABEL_ASIDE
rather than a component feature with its own property?
One unfortunate detail in using the built-in label aside is that there's currently no way (that I'm aware of) to make the labels have dynamic width, i.e. automatically be as wide as the widest label in the form (e.g. in a vaadin-form-layout
). Instead, a css property would be used to set a fixed width for the labels.
Dynamic label width is a feature of the css-grid form-layout refac here: https://github.com/vaadin/web-components/issues/4583, which still uses the current vaadin-form-item
wrappers for having labels outside the component. So by using these aside-labels-in-components we lose that.
I'm quite certain dynamic label width would be possible with CSS sub-grid, but browser support is still quite far away: https://caniuse.com/css-subgrid
Theme variant sounds fine! (If it's feasible to implement. Otherwise the property would be also okay)
One unfortunate detail
Personally, I'm totally fine with that. Normally people should test their app with the supported locales anyway.
Dynamic label width
Couldn't this be implemented in the form? Like it knows all fields you add and calculates with JS the widest label and apply this width to the label? There are probably edge cases I forgot.. but it sounds possible theoretically.
Regardless of different strings for different locales, it would be useful to have dynamic label width, so that you wouldn't have to adjust the width in your forms at all β it would just automatically be wide enough for the labels, so that if you only have very short labels, the label "column" would only be as wide as they need, and if you have longer labels in another form, they'd automatically adapt to accommodate that.
But yes, you're correct in that it could probably be implemented with scripting. It's just that 1) that's a hassle, 2) those solutions tend to be buggy and/or not entirely reliable, and 3) pure css solution would be nicer.
Sadly all three points are valid concerns πββοΈ
Description
Built-in support for rendering labels "aside" (instead of on top) in all input field components, without the need for
vaadin-form-item
wrappers.Acceptance criteria
label-position="aside"
orlabel-aside
attribute on the component (dedicated Flow API postponed until later)vaadin-form-layout
vaadin-form-layout
forresponsiveStep
s with"labelsPosition":"aside"
General criteria