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
Transitions #14
Comments
Was just thinking this would be great to have baked in too. Like you say - best to keep things simple and reserve any utility classes to basic transitions like button hover states etc. I've never really figured out if there's any performance downside to using the 'all' keyword when setting up css transitions e.g. transition: all 200ms ease. If not then initially it might make sense to make this the default transition property. If you assume that as a default then the two parts of the declaration left are duration and easing. As far as easing goes it would probably be nice to be able to specify an easing type but in practise that might be kinda cumbersome (it would certainly increase the number of potential class names). If the basic use case is for buttons and other interactive elements I'd be happy with something like 'ease' which generally looks pretty good. If that just leaves us with timing then I guess having something like the opacity property in the config file would probably work e.g.:
To output a class like: .transition-400 Or maybe go with a keyword based approach more like shadows, something like
Then: .transition-fast These are just initial thoughts - I've probably (or more likely definitely!) not considered all the angles but I agree that it would be great to see something like this in the framework |
I like the keyword based approach you suggested. |
@niallobrien Why did you close this? |
That's strange...I didn't. 4 hours ago would've been 7am my time, just as I was getting up for work... |
I'd reopen as it is a feature request. |
Reopened! |
I'd like to see easing in the config, even if it's simply to provide your easing method of choice as default. Both should have a
Some example generated classes:
Alternative idea: split easing and durations ( Final thought: |
I think the best way to implement this, is to do something similar like we did with the |
I prefer the keyword based approach as well. As with the shadows, Tailwind makes some design decisions on how the shadow should look which is easy enough to customize. As with the shadow feature, it uses a default value as stated above. I think something like the below is just enough to be effective.
|
I'm currently using the |
What is the current process on this feature? Would it also be possible to add transition timings following the same convention as i.e. the border styles; Edit: referring to the transitionTimingFunctions mentioned by @sebastiandedeyne. |
This is what I currently have in my custom utilities: .trans {
transition: all .25s;
}
.trans-bg {
transition-property: background;
}
.trans-slow {
transition-duration: .5s;
}
.trans-slower {
transition-duration: .5s;
}
.trans-fast {
transition-duration: .15s;
}
.trans-faster {
transition-duration: .075s;
} That way all of these work: <div class="trans" /> <!-- Sane default -->
<div class="trans trans-bg" /> <!-- Background instead of all, must put .trans first -->
<div class="trans trans-fast" /> <!-- Transition quicker --> I could also see doing something like: *, :after, :before {
transition-duration: .25s;
transition-property: none;
}
.trans {
transition-property: all;
} And then keep the rest the same (kind of how borders are currently set by tailwind). I'm not 100% sure if that would break lots of 3rd-party CSS, though. Finally, I think that the timing functions should be their own classes: .trans-linear {
transition-timing-function: linear;
}
/* etc */ |
@inxilpro Are those custom utilities just in a css file or is there a way to set them in tailwind.js and have them be generated? |
@rightaway Take a look at my tailwind plugin — they can be fully configured if you use the plugin, or else you can just copy-and-paste the above if you just want a quick-and-dirty solution. |
We can add common utilities which are not present in tailwind by default, in plugins section of tailwind.config.js as 'addUtilities' function. |
Add independent axis overflow hidden to the docs
Will this be merged into the core project this is kind of make or break to be honest? |
@louisjacksonrees planning to explore the API for this and the default values soon. In the mean time you can always install a plugin like this one: https://github.com/benface/tailwindcss-transitions Or simply write the classes yourself: |
Implemented in v1.2.0. |
Hi, I'm just wondering what are peoples' thoughts about perhaps including some transition-based utility classes?
Nothing too complex, just to cover some common use-cases, eg. smooth hover state transitions on buttons etc. If so, what kind of syntax would you expect to use to keep in line with Tailwind's current naming conventions?
The text was updated successfully, but these errors were encountered: