0

Below is the html code

<lightning-radio-group name="radioGroup" label="Options" options={options}
onchange={handleChange}></lightning-radio-group>

JS

  options = [
    { label: 'ECO', value: 'ECO' },
    { label: 'Normal', value: 'Normal' },
    { label: 'Sport', value: 'Sport' },
   ];

ECO radio option should be checked bydefault

1 Answer 1

1

Via the documentation found here, in your javascript do this, set the value and use this value in your lighting-radio-group. I have edited the code for you, please find it below.

JS

value = 'ECO';
options = [
{ label: 'ECO', value: 'ECO' },
{ label: 'Normal', value: 'Normal' },
{ label: 'Sport', value: 'Sport' },
];

HTML

<lightning-radio-group name="radioGroup" label="Options" options={options}
onchange={handleChange} value={value}></lightning-radio-group>

Hope it helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .