feat(SelectMenu): handle function in showCreateOptionWhen prop (#1853)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Vincent Ratier
2024-07-18 12:51:01 +01:00
committed by GitHub
parent 6aaf12b9af
commit 7e974b55d7
3 changed files with 78 additions and 2 deletions

View File

@@ -188,6 +188,18 @@ componentProps:
---
::
Pass a function to the `show-create-option-when` prop to control wether or not to show the create option. This function takes two arguments: the query (as the first argument) and an array of current results (as the second argument). It should return true to display the create option.
The example below shows how to make the create option visible when the query is at least three characters long and does not exactly match any of the current results (case insensitive).
::component-example
---
component: 'select-menu-example-creatable-function'
componentProps:
class: 'w-full lg:w-48'
---
::
## Popper
Use the `popper` prop to customize the popper instance.