I can't add property to RadioButtonGroup & CheckboxGroup


For some style customizations, I want to add properties to the component.

RadioButtonGroup<SampleClass> radioButtonGroup = new RadioButtonGroup<>();
radioButtonGroup.getElement().setProperty("xyz", true);

Is there another way to add the properties?

No, this is the correct way to add the property “xyz”. Your shown code will result in html similar to this: <vaadin-radio-button xyz >...</vaadin-radio-button>.

Maybe there is a misunderstanding of [what a property is]
(https://vaadin.com/docs/v14/flow/element-api/tutorial-properties-attributes.html)? You say “For style customizations”, but usually* styles are customized either by adding a class to the element, or by changing its style directly. I believe you meant either of those.

radioButtonGroup.getStyle().set("color", "green");


*you can in fact impact styles with properties. for example the “disabled” property usually impacts the style

Actually, my expectation is that it is added to the vaadin-radio-group element. <vaadin-radio-group column = "2"> ... </vaadin-radio-group> I need this property as a css selector.

radioButtonGroup.getElement().setProperty("column", "2");

I don’t add the column property with this method.

oops my mistake, yes it should be added on the vaadin-radio-group element.
I did try it out and you are correct, there is no property being set on the RadioButtonGroup. Could you open a new issue in [github]

Thanks. I opened the issue separately for both.

RadioButtonGroup issue; https://github.com/vaadin/vaadin-radio-button-flow/issues/135
CheckboxGroup issue; https://github.com/vaadin/vaadin-checkbox-flow/issues/147