The FormLayout guide (Vaadin 24) is not correct

Hello,

I’m learning the capabilities of FormLayout by provided guide:

But as I can see the documentation is not actual:

formLayout.setLabelWidth("60px"); // the method does not exist.

My vaadin version is 24.4.9

Could you fix this or say how can I workaround it?

The documentation is “too up-to-date” - this feature is only available in 24.5 to be released in the upcoming weeks.

See this paragraph:

The width of side-positioned labels can be adjusted using the --vaadin-form-item-label-width CSS property on the Form Layout element, or with the setLabelWidth() (V24.5 pre-release) method on the FormLayout instance in Flow.

Thanks Christian, looking forward the the new version! It would be great to put such info before the paragraph started :slightly_smiling_face:

Currently I can use --vaadin-form-item-label-width CSS class property, correct?

Correct, e.g.

var layout = new FormLayout();
layout.getStyle().set("--vaadin-form-item-label-width", "7rem"); // todo change with 24.5
1 Like