Skip to content

Commit 146c0d6

Browse files
committed
feat: expose the closeMenuOnSelect option in dropdown component
1 parent 4c2a637 commit 146c0d6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

components/dash-core-components/src/components/Dropdown.react.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ Dropdown.propTypes = {
145145
*/
146146
disabled: PropTypes.bool,
147147

148+
/**
149+
* If false, the menu of the dropdown will not close once a value is selected.
150+
*/
151+
closeMenuOnSelect: PropTypes.bool,
152+
148153
/**
149154
* height of each option. Can be increased when label lengths would wrap around
150155
*/
@@ -232,6 +237,7 @@ Dropdown.defaultProps = {
232237
searchable: true,
233238
optionHeight: 35,
234239
maxHeight: 200,
240+
closeMenuOnSelect: true,
235241
persisted_props: ['value'],
236242
persistence_type: 'local',
237243
};

components/dash-core-components/src/fragments/Dropdown.react.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const RDProps = [
3333
'maxHeight',
3434
'style',
3535
'className',
36+
'closeMenuOnSelect'
3637
];
3738

3839
const Dropdown = props => {
@@ -46,6 +47,7 @@ const Dropdown = props => {
4647
style,
4748
loading_state,
4849
value,
50+
closeMenuOnSelect,
4951
} = props;
5052
const [optionsCheck, setOptionsCheck] = useState(null);
5153
const persistentOptions = useRef(null);
@@ -158,6 +160,7 @@ const Dropdown = props => {
158160
value={value}
159161
onChange={onChange}
160162
onInputChange={onInputChange}
163+
closeMenuOnSelect={closeMenuOnSelect}
161164
backspaceRemoves={clearable}
162165
deleteRemoves={clearable}
163166
inputProps={{autoComplete: 'off'}}

0 commit comments

Comments
 (0)