Let vaadin-radio-button-group set selected radio button on-load
Closed this issue · 0 comments
Here's some code similar to what we have on the vaadin-radio-button repository:
<vaadin-radio-button-group value="large">
<vaadin-radio-button value="small">Small</vaadin-radio-button>
<vaadin-radio-button value="medium">Medium</vaadin-radio-button>
<vaadin-radio-button value="large" checked>Large</vaadin-radio-button>
</vaadin-radio-button-group>
Scenario
If I were writing an application and wanted to select a radio-button
by default as the page loads but don't care about using the radio-button
checked
property, I should just set the value to be selected on the enclosing radio-button-group
. This will let me be able to render an arbitrary list of radio-buttons and dynamically set which is selected on page load without resorting to using if statements on each radio button to determine which one should be selected.
I believe the existing value
property of the vaadin-radio-button-group
can be used to accomplish this.
Useful in edit mode (e.g. account settings/preferences/profile update)