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

How do I clear a selected item in the selectMenu component? #1275

Closed
wallysonn opened this issue Jan 23, 2024 · 5 comments
Closed

How do I clear a selected item in the selectMenu component? #1275

wallysonn opened this issue Jan 23, 2024 · 5 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@wallysonn
Copy link

Description

Would it be possible to add an "x" to the component to clear it?

@wallysonn wallysonn added the question Further information is requested label Jan 23, 2024
Copy link
Member

Have you tried using the #trailing slot like the Select? https://ui.nuxt.com/forms/select#trailing

@benjamincanac benjamincanac added the duplicate This issue or pull request already exists label Jan 24, 2024 — with Volta.net
Copy link
Member

Duplicate #1057

@benjamincanac benjamincanac closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2024
@wallysonn
Copy link
Author

Have you tried using the #trailing slot like the Select? https://ui.nuxt.com/forms/select#trailing

Thank you for taking the time to answer my question. In this case I am using the SelectMenu component and not Select. SelectMenu is better for my needs, as it is visually more beautiful and functional with the search field. His problem, I don't know how to get around it at all, is that after I select an item, I can't remove the selection.

Copy link
Member

The SelectMenu inherits from the Select, you can use the #trailing slot there too.

By design, a select can't be unselected, this is the normal behaviour. You either use the #trailing slot, add another button on the side with the ButtonGroup component or make it multiple to be able to unselect values.

@wallysonn
Copy link
Author

The SelectMenu inherits from the Select, you can use the #trailing slot there too.

By design, a select can't be unselected, this is the normal behaviour. You either use the #trailing slot, add another button on the side with the ButtonGroup component or make it multiple to be able to unselect values.

Forgive my lack of attention. I understood that it only worked in the Select component. I tested it here and it worked perfect. Thank you and have an amazing day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants