Transition Timing Function
- Tailwind CSS version
- v1.2.0+
Utilities for controlling the easing of CSS transitions.
Usage
Use the ease-{timing}
utilities to control an element's easing curve.
<button class="transition ease-in duration-700 ...">Hover me</button>
<button class="transition ease-out duration-700 ...">Hover me</button>
<button class="transition ease-in-out duration-700 ...">Hover me</button>
Responsive
To control an element's transition-timing-function at a specific breakpoint, add a {screen}:
prefix to any existing transition-timing-function utility. For example, use md:ease-in-out
to apply the ease-in-out
utility at only medium screen sizes and above.
For more information about Tailwind's responsive design features, check out the Responsive Design documentation.
Customizing
Timing values
By default Tailwind provides four general purpose transition-timing-function utilities. You change, add, or remove these by customizing the transitionTimingFunction
section of your Tailwind theme config.
// tailwind.config.js
module.exports = {
theme: {
extend: {
transitionTimingFunction: {
+ 'in-expo': 'cubic-bezier(0.95, 0.05, 0.795, 0.035)',
+ 'out-expo': 'cubic-bezier(0.19, 1, 0.22, 1)',
}
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
Responsive and pseudo-class variants
By default, only responsive variants are generated for transition-timing-function utilities.
You can control which variants are generated for the transition-timing-function utilities by modifying the transitionTimingFunction
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
// ...
- transitionTimingFunction: ['responsive'],
+ transitionTimingFunction: ['responsive', 'hover', 'focus'],
}
}
Disabling
If you don't plan to use the transition-timing-function utilities in your project, you can disable them entirely by setting the transitionTimingFunction
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ transitionTimingFunction: false,
}
}