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

[Autocomplete] Ability to add an Add button with multiple + freeSolo #18223

Closed
1 task done
andreasheim opened this issue Nov 5, 2019 · 5 comments · Fixed by #18285
Closed
1 task done

[Autocomplete] Ability to add an Add button with multiple + freeSolo #18223

andreasheim opened this issue Nov 5, 2019 · 5 comments · Fixed by #18285
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@andreasheim
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

I would like to either

  • optionally include an Add or + button when multiple & freeSolo are enabled
  • or be able to trigger onChange & clear the input from a separate button

On a separate note, it'd be nice to optionally being able to show the up/down chevron when freeSolo is on.

Examples 🌈

I'm replacing existing autocomplete components in our app that use outdated technology

Screen Shot 2019-11-05 at 2 07 55 PM

Motivation 🔦

We have users who do not understand that you can add multiple values into an <Autocomplete> by hitting enter

When entering a value not in the list of options, there's no indication that this an input that allows you to enter multiple values, as the dropdown is closed.

Screen Shot 2019-11-05 at 2 11 58 PM

Screen Shot 2019-11-05 at 2 13 41 PM

I was able to get this partially to work.

  • I can use onChange on the TextInput to get the current input value
  • I can call onChange on a prop with the value added (e.g. props.onChange(props.value.concat(inputValue))

However then I'm not able to clear the input value.

I might be missing something obvious that's already in place.

Thank you, love what you're doing

@oliviertassinari
Copy link
Member

Would this proposal fix the issue? #18113 (comment)

@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Nov 5, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 5, 2019

@andreasheim Random question, is this deployed in moz.com? We have a paid subscription to ahrefs.com, but maybe there is a chance we can get a free moz.com account and transition? 😁

@oliviertassinari oliviertassinari added the new feature New feature or request label Nov 5, 2019
@andreasheim
Copy link
Contributor Author

andreasheim commented Nov 5, 2019

@oliviertassinari Yes, that proposal would enable me to create the functionality I'm seeking.

Also yes, I'm working on using this in moz.com. I forwarded this.

@oliviertassinari
Copy link
Member

@andreasheim Awesome, let's make the input value controllable then :) (thanks for forwarding).

@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Nov 6, 2019
@oliviertassinari oliviertassinari self-assigned this Nov 9, 2019
@oliviertassinari oliviertassinari removed the good first issue Great for first contributions. Enable to learn the contribution process. label Nov 9, 2019
@jonahcarneskog
Copy link

Wouldn't it be so much better to use the "noOptionsText"?
Adding a Add there shows a stylable add-button when there are no options.
The only issue is that the noOptionsText closes when the button is clicked. A "keep open" prop would be awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants