-
Notifications
You must be signed in to change notification settings - Fork 226
Change caret color on selects elements #17
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
Comments
I'd like to know the recommended way of changing properties like |
That's 'out of the box' tailwind and will work on form elements as you can use standard tailwind utilities to style with this new version of the forms plugin. Best to check out the docs. https://tailwindcss.com/docs/ring-color |
I spent some hours digging into the code. Unfortunately,
|
I'm thinking this is just a good reset and then you would change the carrot color with simple utility @apply classes (you could of-course put all the classes right on the elements):
HTML:
The bg-none on the select is important because that is how the carrot from the forms plug is shown. Please correct me if I am wrong because I'm trying to learn this. PS: the text-gray-400 on the main txt-select colors the selects placeholder, then the text-gray-800 on the txt-select:focus changes the options to the right color when the select is clicked...ooops then the option changes back to gray-400 when it looses focus. Oh well, at least the placeholders match on first look. If someone can help me change the color of that first disabled option (and keep it when loosing focus) this would be perfect. |
Just learned I can also do this to change the icon:
|
Great solutions provided, but I have another issue. I have the tailwind theme created using css variables . And with the svg elements not working with css variables, the generated svg from the plugin is generated but one cannot see it.😒 For now I have overridden the css to make it work , including the dark mode (not very clean , but just a workaround ...)
|
That looks great and all, but isn't this supposed to work out of the box with tailwindcss-forms? |
My case was a bit specific. I have created my tailwind theme based on custom css variables that define the colors like grey-500. Only in this case you may require this work around for the select element caret issue as svgs don't support css variables |
@tsukhu Thanks for your explanation, however I was merely reacting to the top post. As I also wrongly assumed you could do |
Seems like an oversight. |
Here I am running into this again. |
the caret color was an issue for me as well, I was able to get the desired look with a background blend mode property since I wasn't able to modify the background svg's path stroke, background blend mode 'hard-light' worked for me in light and dark mode and with my dynamic color scheme selection features... |
So just to clarify in case it helps anyone looking as I did for this solution to the gray caret... I added "bg-blend-hard-light" to the select and it works with a subtle arrow regardless of bg color or color mode, it's not precision color control but no js or css hack to the plugin required and I can style with utilities only approach |
Hey! Thank you for your bug report! The caret is implemented as a custom background image. Since it is a background image it is not possible to style this svg using normal css. The color is hardcoded to If you want a complete new icon, then it is best to override the full icon with whatever icon you want. Here is the current implementation: tailwindcss-forms/src/index.js Lines 88 to 93 in bb5315c
In the future I think we can expose a dedicated option in the |
Sounds like a good solution to me without breaking changes. |
Adding on top of @caicodes's suggestion. I found |
It can't be customized in `@tailwindcss/forms`. See tailwindlabs/tailwindcss-forms#17
I have tried using @darioguarascio approach with updated approach with how plugins are now delcared but it doesn't appear to override the arrow anymore... does anyone have thoughts on this or how it could work now?
|
Further to my reply above - you must also add the component with the class name '.form-select' as well as 'select' if you intend the change to be applied to both CSS selectors
|
Unless I'm mistaken these are all grey-500. Any chance of adding a way to customise the color of these, either via a utility class or within the config?
The text was updated successfully, but these errors were encountered: