diff --git a/components/lib/dropdown/Dropdown.js b/components/lib/dropdown/Dropdown.js index 4ce9724498..7a526776a9 100644 --- a/components/lib/dropdown/Dropdown.js +++ b/components/lib/dropdown/Dropdown.js @@ -825,6 +825,10 @@ export const Dropdown = React.memo( }; const getOptionValue = (option) => { + if (props.useOptionAsValue) { + return option; + } + const optionValue = props.optionValue ? ObjectUtils.resolveFieldData(option, props.optionValue) : option ? option['value'] : ObjectUtils.resolveFieldData(option, 'value'); return props.optionValue || ObjectUtils.isNotEmpty(optionValue) ? optionValue : option; diff --git a/components/lib/dropdown/dropdown.d.ts b/components/lib/dropdown/dropdown.d.ts index de11f4e693..5b84f2fb5f 100644 --- a/components/lib/dropdown/dropdown.d.ts +++ b/components/lib/dropdown/dropdown.d.ts @@ -407,6 +407,10 @@ export interface DropdownProps extends Omit boolean) | undefined; + /** + * Whether the option should be used as the value for the select element. + */ + useOptionAsValue?: boolean; /** * Property name or getter function that refers to the children options of option group. * @defaultValue items