Trying to Iterate the object value in the Radio button group
Issue: When I select Force and Select Sales, Both button shows as selected. Expecting one should select on selection.
Note: Tried by by lightning-radio-group
with type="button"
It's working. trying to Implement in SLDS.
<fieldset class="slds-form-element">
<legend class="slds-form-element__legend slds-form-element__label">Radio Group Label</legend>
<div class="slds-form-element__control">
<div class="slds-radio_button-group">
<template for:each={options} for:item="op" for:index="index">
<span class="slds-button slds-radio_button" key={op.value}>
<input type="radio" name={op.label} id={op.label} value={op.label} />
<label class="slds-radio_button__label" for={op.label}>
<span class="slds-radio_faux">{op.label}</span>
</label>
</span>
</template>
</div>
</div>
</fieldset>
import { LightningElement } from 'lwc';
export default class RadioGroupButtonDisabled extends LightningElement {
value = '';
get options() {
return [
{ label: 'Sales', value: 'option1' },
{ label: 'Force', value: 'option2' },
];
}
}
value
anddisabled
attributes.disabled
, all button will be disabled, Want to disable the particular button, Not all the Button