paper-radio-group
paper-radio-group copied to clipboard
A "better than the standards" suggestion for API
The API for form elements in standard HTML and in Polymer iron-form elements is more complicated than it needs to be. I propose that every element with a name attribute would have a corresponding value attribute, and we call it a day.
For example, the API for paper-radio-group element...
<paper-radio-group selected="small">
<paper-radio-button name="small">Small</paper-radio-button>
<paper-radio-button name="medium">Medium</paper-radio-button>
<paper-radio-button name="large">Large</paper-radio-button>
</paper-radio-group>
... could become simpler by modeling after a standard HTML select list like...
<select name="shirt-size">
<option value="small" selected>Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
... but could be better than the select list API by doing away with selected boolean and instead stay consistent with the "every element with a name attribute has a corresponding value attribute" proposal...
<paper-radio-group name="shirt-size" value="small">
<paper-radio-button value="small">Small</paper-radio-button>
<paper-radio-button value="medium">Medium</paper-radio-button>
<paper-radio-button value="large">Large</paper-radio-button>
</paper-radio-group>
If it interests anyone here, we're trying to document the Iron Form Elements API here and also discussing its design https://github.com/PolymerElements/iron-form/issues/217