2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-13 08:32:26 +03:00

allow open prop to control menu state

This commit is contained in:
Jeff Sagal
2022-11-16 20:55:04 -08:00
parent 6c9a480a04
commit 5a5e9378d9
6 changed files with 58 additions and 50 deletions
+2 -5
View File
@@ -3,12 +3,9 @@
By default, the dropdown will open anytime the underlying search input has focus. The dropdown will
open when clicked, or when it has received focus when tabbing through inputs.
## Customizing Dropdown Behaviour <Badge text="v3.12.0+" />
## Customizing Dropdown Behaviour <Badge text="v4+" />
The `dropdownShouldOpen` prop allows for full customization of the open/close behaviour. The prop
accepts a `function` that should return a `boolean` value. The returned boolean value will be used
to determine if the dropdown should be `open`/`true` or `false`/`closed`. The function receives the
instance of the component as the only argument.
The `open` prop can control showing and hiding the dropdown menu from a parent component. If this prop is set, the component will always use the value of `props.open` to handle showing and hiding the dropdown. Vue Select will emit the `update:open` when the prop value should change, so you can use `<VueSelect v-model:open="open" />` to have control over the `open` state while preserving default behaviour.
#### Example: Open the dropdown when search text is present
---