diff --git a/components/select/src/simple-single-select-field/simple-single-select-field.js b/components/select/src/simple-single-select-field/simple-single-select-field.js index 453ce6482..2f053e827 100644 --- a/components/select/src/simple-single-select-field/simple-single-select-field.js +++ b/components/select/src/simple-single-select-field/simple-single-select-field.js @@ -137,6 +137,12 @@ SimpleSingleSelectField.propTypes = { /** Allows to modify the max height of the menu **/ menuMaxHeight: PropTypes.string, + /** See [dropdown menu width](https://developers.dhis2.org/docs/ui/components/select#dropdown-menu-width) **/ + menuMaxWidth: PropTypes.string, + + /** See [dropdown menu width](https://developers.dhis2.org/docs/ui/components/select#dropdown-menu-width) **/ + menuMinWidth: PropTypes.string, + /** String that will be displayed when the select is being filtered but the options array is empty **/ noMatchText: requiredIf((props) => props.filterable, PropTypes.string), diff --git a/components/select/src/simple-single-select-field/simple-single-select-field.prod.stories.js b/components/select/src/simple-single-select-field/simple-single-select-field.prod.stories.js index d8b04d504..b39c9c786 100644 --- a/components/select/src/simple-single-select-field/simple-single-select-field.prod.stories.js +++ b/components/select/src/simple-single-select-field/simple-single-select-field.prod.stories.js @@ -26,6 +26,13 @@ const options = [ { value: '10', label: 'ten' }, ] +const longOptions = [ + { value: '1', label: 'option one' }, + { value: '2', label: 'option two' }, + { value: '3', label: 'option three' }, + { value: '4', label: 'A longer option that exceeds the minimum' }, +] + export default { title: 'SimpleSingleSelectField', component: SimpleSingleSelectField, @@ -186,3 +193,45 @@ export const InputWidth = () => { ) } + +export const WithMenuMinWidth = () => { + const [value, setValue] = useState('') + const valueLabel = value + ? longOptions.find((option) => option.value === value)?.label + : '' + + return ( +