Replies: 1 comment 4 replies
-
Hi @pop1989bb could you please elaborate on why the current implementation using the I've also prepared an example that is showing the behavior in action: https://stackblitz.com/edit/combobox-selection?file=src%2FApp.tsx function App() {
const [selectedItem, setSelectedItem] = useState({ text: '', key: '' });
return (
<>
<ComboBox
onSelectionChange={(e) => {
const { item } = e.detail;
console.log(item);
setSelectedItem({
text: item.text,
key: item.dataset.someMoreInfo!,
});
}}
>
<ComboBoxItem text="ComboBox Entry 1" data-some-more-info="key1" />
<ComboBoxItem text="ComboBox Entry 2" data-some-more-info="key2" />
<ComboBoxItem text="ComboBox Entry 3" data-some-more-info="key3" />
<ComboBoxItem text="ComboBox Entry 4" data-some-more-info="key4" />
<ComboBoxItem text="ComboBox Entry 5" data-some-more-info="key5" />
</ComboBox>
<br />
{JSON.stringify(selectedItem, null, ' ')}
</>
);
} |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I think it would be a good idea to provide a onClick/onSelect support per ComboBoxItem.
I often want to add some functionality which depends on the selected combobox item. Do you think it would be possible to add this in a future version?
Kind regards
Beta Was this translation helpful? Give feedback.
All reactions