Reputation: 43
I have created a combo-box in LWC for which, I want to default a value.The options for the LWC are fetched from controller. I tried the following & it dint work. I have removed the "placeholder="-Select-", but still OOB i see a place holder "Select a value". I want to remove the OOB placeholder & also default it to a particular value on load.
<lightning-combobox required
label="Values"
class="value"
value={choosenValue}
options={choosenValueOptions}
onchange={handleValueChange} >
</lightning-combobox>
TIA, Sunil
Upvotes: 2
Views: 11319
Reputation: 31209
Add in the Javascript code the default value:
export default class ComboboxBasic extends LightningElement {
@track chosenValue = 'defautValue';
...
}
Upvotes: 0