Hi Paul,
Thank you for the feedback provided.
The <kendo-radiobutton> component currently exposes a string-valued value input, so broader value types would require an enhancement. We will track the customer demand for this request and implement it in the future based on interest.
An available alternative is the kendoRadioButton directive applied to native radio inputs. This is the 'old way' of how radio buttons were defined before creating a respective <kendo-radiobutton> component.
Both provide Kendo styling, but differ in how they handle the input:
| Directive | Component | |
|---|---|---|
| Usage | <input type="radio" kendoRadioButton> | <kendo-radiobutton> |
| Rendering | Styles an existing native input | Creates and wraps an internal input |
| Forms integration | Angular’s native radio value accessor | Kendo’s own value accessor |
| Values | Preserves numbers, strings, objects, null, and undefined through Angular Forms | String-valued value input |
| Attributes/events | Native input attributes and events | Component APIs such as checkedChange, inputAttributes, and focus() |
With Angular Forms and `[value]` property binding, the Angular model retains numbers, `null`, and `undefined`, while labels display separate descriptions:
<fieldset>
<legend>Choose an option</legend>
@for (option of options; track option.id) {
<div>
<input
type="radio"
kendoRadioButton
name="selection"
[id]="option.id"
[value]="option.value"
[(ngModel)]="selectedValue"
/>
<label class="k-radio-label" [for]="option.id">
{{ option.text }}
</label>
</div>
}
</fieldset> public selectedValue: number | null | undefined | string = 1;
public options = [
{ id: 'option-one', value: 1, text: 'First option' },
{ id: 'option-two', value: '2', text: 'Second option' },
{ id: 'option-none', value: null, text: 'None' },
{ id: 'option-unset', value: undefined, text: 'Not specified' }
];Here, selecting First option sets the model to the number `1`, rather than the string `"1"`. The nullish options likewise retain their respective values.
This preserves values in the Angular model; native HTML form submission still serializes radio values as strings. If `null` or `undefined` represents a selectable option, initializing the model to that value selects the matching option.
Regards,
Martin Bechev
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.