You do not have direct way of getting label (as you get only selected value in event.detail
). You need to depend on all options (simply get it from event.target
) and filter based on selected value. You can use below:
JS:
@track selectedLabel;
get options() {
return [
{ label: 'New', value: 'new' },
{ label: 'In Progress', value: 'inProgress' },
{ label: 'Finished', value: 'finished' },
];
}
handleChange(event) {
this.selectedLabel = event.target.options.find(opt => opt.value === event.detail.value).label;
}
HTML:
<lightning-combobox name="progress"
label="Status"
placeholder="Select Progress"
options={options}
onchange={handleChange}></lightning-combobox>
<p>Selected label is: {selectedLabel}</p>