Replies: 1 comment
-
Hi @buzzo123 - I ran into this issue this week in looking into migrating some PCF controls to V9. I found that if you don't set the Option "value" to your key of your object and the text to the text it seems to default the value to the text. Here is an example that solved this for me. I am using Combobox but I believe the logic is the same for Dropdown. `/* eslint-disable no-debugger */ const useStyles = makeStyles({ export const TemplateGroupSelection = ( const selectedListRef = React.useRef(null);
const styles = useStyles(); {categorySelectionProps.labelText} {selectedOptions.length ? (
{/* The "Remove" span is used for naming the buttons without affecting the Combobox name */} <span id={ ${comboboxId}-remove } hidden>Remove {selectedOptions.map((option, i) => ( ))} ) : null} <Combobox aria-labelledby={labelledBy} placeholder="Select applicable options" multiselect={true} selectedOptions={selectedOptions.map((option) => option.key)} onOptionSelect={onSelect} ref={comboboxInputRef} {...comboboxProps} > {categorySelectionProps.options.map((option) => ( {option.text} ))} ); }; ` |
Beta Was this translation helpful? Give feedback.
-
I've been using Fluent UI 8, and in the Dropdown component, there was the IDropdownOption interface with properties like key and text. However, in Fluent UI 9, I couldn't find a way to set or retrieve the key value of an option. I only see options to retrieve the text value with onOptionSelect.
Am I missing something, or has the key functionality been changed or moved in Fluent UI 9? Any guidance on this matter would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions