Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose hook with current input to user #54

Open
andrelandgraf opened this issue Oct 22, 2022 · 0 comments
Open

Expose hook with current input to user #54

andrelandgraf opened this issue Oct 22, 2022 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@andrelandgraf
Copy link
Owner

andrelandgraf commented Oct 22, 2022

Problem

I don't think there is currently a way for a user to access the current input value of the input field. The input value would be useful in case one wants to use a custom item component that highlights the matching part of the label string.

Background

You can pass a custom component for each item in the items array as a node property. The node property will then be rendered for each item. In that case, you currently do not have access to the current input to do some custom highlighting.

Custom highlighting would require that the module exposes a hook that has access to ComboboxContext. ComboboxContext should be extended to also include the current input value. The value can then be exposed via the hook and accessed in the custom item component.

Task

Add current input value to ComboboxContext and expose ComboboxContext values through hook to use in custom item component.

  1. Investigate if there is currently a way to access the input value
  2. Pass current input value to ComboboxContext
  3. Create hook that is exposed to user that returns value (and maybe other useful data)
  4. Document use case in README
@andrelandgraf andrelandgraf added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant