-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Feature discussion] Add variants through plugins #496
Comments
Would it be possible to define where the variant rules will appear in the compiled CSS? Maybe at least an option between before and after the default rules? |
So as part of this feature, my plan is to make generated variant order mirror the order in the So if you have:
... |
@adamwathan So all variants would be generated after the default/normal rules? Unless I’m misunderstanding, that would be a problem for the
|
I think we could solve that by adding an optional |
@adamwathan You always come up with the most thoughtful solutions. :) |
You have |
This isn't about adding |
Sorry very new to tailwindcss and didn't understand the new API at first. Yeah,- totally would be useful! |
Boy oh boy, I'm exited! Came here looking for something this! Is it what I need? Not sure...let me explain. tldr: I need different layouts based on custom app states which are defined by a css class on a parent element (e.g. the body element) – a common usecase for websites/components, I think? Details: I've got a big header on my site for desktop. On tablet and downwards this header will become a minimal version of itself. Mobile nav menu, no searchbar, you name it. No problem as this can be done with tailwind. However, the header has two states: static and fixed position. So I threw in the some JS for recalculation/offset and set a body class to make it fixed: I'm currently doing those extensions myself:
Obviously, a mixin/function would help but I stopped here because I found your post. 👍 Also, if you exchange So yes, @adamwathan, totally upvoting your idea here! Is it even possible to use your code right now? As you can see from the example, I think I'd also need an option to make a prefix class like Basically, something like the functionality of tailwinds I think this is going into the right direction however. Again, so happy I met tailwind (great name by the way)! Sidenote: I changed the separator from |
This is a feature I'd like - I'll try it out when I can. I'd like to use it in conjunction with something like https://github.com/ten1seven/what-input I want to stay responsible with focus states and not really change them and yet our designers can't deal with blue rings around every button. Nor do I want to just change all focus states as it becomes hard to strike a balance between mouse-hover and mouse-focus sometimes. We're going to need some nuance in our focus styles, so I was wondering if we could have something liek I could then also write a class (somewhere in my sass) like this:
...which would, when mouse is being used, remove focus outlines where I've thought to put some sort of mouse-focus state (so that I'm never accidentally removing all kind of focus guidance). It's long winded, but such is the situation. |
This feature is implemented now (at least in a basic state) so closing! |
Was brainstorming a bit on what it might look like to support adding new variants (hover, focus, etc) through the plugin system.
Here's a bit of code exploring what that API might look like:
Anything anyone can think of that would be useful to support that this API couldn't handle?
The text was updated successfully, but these errors were encountered: