ComboBox.Input add additional API props #1255
saulflores95
started this conversation in
Ideas
Replies: 1 comment
-
At the very least it would be nice to be able to pass an onKeyDown handler. For example, I'd like to be able to change what key opens/closes the list. One way of keeping the existing behavior for some cases but not all cases is for the exposed onKeyDown, if the event's default is prevented, then the HeadlessUI implementation is not called. Obviously the downside is that the event will also be prevented on the native event. Alternatively, having onKeyDown return false could prevent the HeadlessUI implementation from being called. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
For example v1.5.0
What browser are you using?
Chrome
Currently using headless UI Combo Box we are using it to be able to select existing 'tags' and if a tag does not exist we create it by clicking on an icon that was added. This onClick event triggers a method called addOnClick.
The functionality we want is to detect when the 'Enter is pressed I want to trigger the same addOnClick Method.
The component looks as such.
Currently, it is not shown in the docks if it's possible to expand the current onKeyDown functionality that headless UI already provides.
By taking a look at headless UI we can see there is an interface that defines the two possible props to pass down
and a type where we can see the onKeyDown event being an option.
Is there any possible way of augmenting/expanding the keyDown prop? For example, just wanting to trigger the addOnClick method when a key down event is detected an enter key being pressed?
For example
Beta Was this translation helpful? Give feedback.
All reactions