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

use different styling options for clear_button and clear_tag_button #75

Closed
Munksgaard opened this issue Jul 11, 2024 · 5 comments · Fixed by #76
Closed

use different styling options for clear_button and clear_tag_button #75

Munksgaard opened this issue Jul 11, 2024 · 5 comments · Fixed by #76
Labels
enhancement New feature or request

Comments

@Munksgaard
Copy link
Contributor

Munksgaard commented Jul 11, 2024

According to the documentation, clear_tag_button uses the clear_button_class and clear_button_extra_class to override and extend the styling. However, The default classes for clear_button and clear_tag_button are different, meaning that if I attempt to override the class of one, the other will inadvertently also be overwritten. Here are what the docs currently look like:

Element Default daisyui classes Default tailwind classes Class override option Class extend option
clear_button cursor-pointer hidden cursor-pointer hidden clear_button_class clear_button_extra_class
clear_tag_button cursor-pointer cursor-pointer clear_button_class clear_button_extra_class

I would expect clear_tag_button to use clear_tag_button_class and clear_tag_button_extra_class instead, but I get an error if I try to use those.

@Munksgaard
Copy link
Contributor Author

It seems like this choice was made on purpose, but I'm not sure I understand why: a054017

Should it not be possible to override the styling for clear_button and clear_tag_button separately?

@maxmarcon
Copy link
Owner

That's because the button to clear the tag is only used in tags mode (multiple selection), whereas the button to clear the selection is only used in single mode (single selection).

So there's no chance of them colliding if your LiveSeelct doesn't dynamically switch between tags to single mode.

@Munksgaard
Copy link
Contributor Author

Aha, I see. The reason why I am trying to override both buttons at the same time, is because I've created a component as suggested here and wanted to apply all my custom branded styling in one place.

If I understand you correctly, if I want the clear_button (for single selection) and the clear_tag_button (for multiple selection) styling to be different, I'll have to create two separate components?

@maxmarcon
Copy link
Owner

Yes, at the moment this is what you should do. A component for multiple selection and one for single selection.

I can see however how this choice of reusing the same name for different styling options is a bit lazy and can lead to confusion. We should change this.

I'll change the name of this issue accordingly, thanks

@maxmarcon maxmarcon changed the title clear_tag_button does not have separate class override functions use different styling options for clear_button and clear_tag_button Jul 11, 2024
@maxmarcon maxmarcon added the enhancement New feature or request label Jul 11, 2024
@maxmarcon
Copy link
Owner

Feel free to write PR for this if you feel like it @Munksgaard !

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

Successfully merging a pull request may close this issue.

2 participants