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

feat: add slot and flag to be able to toggle the clear icon, such that for … #144

Conversation

jbirtel
Copy link
Contributor

@jbirtel jbirtel commented Dec 22, 2022

…empty input one can see that icon and for given input we see the x icon to clear the input

I want to be able to see a magnifying glass/lens instead of the x icon when there is no input. As soon as the user gives any input, i would like to see the x again to be able to clear the input.
Therefore, I created a flag which enables this as well as added a slot such that one can input any <img> or <svg> tag or the like. Further, the slot allows to attach a function to the toggleIcon such that I can e.g. trigger a search functionality or so.

…empty input one can see that icon and for given input we see the x icon to clear the input
@jbirtel jbirtel force-pushed the feature/make_toggling_close_icon branch from 48ea3b6 to 64bd5ec Compare December 23, 2022 14:27
@mskocik
Copy link
Owner

mskocik commented Dec 24, 2022

Isn't this use-case doable wit the latest slot added? Something like this?
REPL

Because I see this as very specific use-case and I would like to avoid everything that's doable on "user" side

@jbirtel
Copy link
Contributor Author

jbirtel commented Dec 27, 2022

Hmm this is not quite what I need.
Can I access the input or at least the input length anyhow from the lately added slot?
So when I have e.g. a variable that stores the values (I think it is called readValues?), is this updated as soon as the first char is given, such that I can react to the first given char directly and not only to the first value selected by the autocompletion?
I really would like to switch the icons as soon as there is any input given by the user.

@mskocik
Copy link
Owner

mskocik commented Jan 3, 2023

Input text or it's length is not accessible from the outside. You could (probably) access the input only by attaching mutation observer to it and going from there... maybe some css class for Control would be enough for your use-case?

@github-actions github-actions bot added the Stale label Jan 25, 2023
@mskocik
Copy link
Owner

mskocik commented Mar 5, 2023

Take a look at latest release, or slot example. Should be fine for your use case I would say with additional properties for clear-icon slot

@mskocik mskocik closed this Mar 5, 2023
@jbirtel
Copy link
Contributor Author

jbirtel commented Mar 6, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants