Add reduce-motion variant#2071
Conversation
|
One limitation I should mention, due to how Tailwind is currently designed, these variants can not be stacked with regular variants like hover, so you can't do this:
I bet this won't be a real issue in practice but it is a bit annoying, and this limitation will be really annoying when we start working on dark mode :/ not sure how to solve without a breaking change to how variants work. Edit: Solved in latest update. |
Start to think about a 2.0 version with the breaking changes needed for the future. |
This pull request includes a small change to the `src/docs/outline-width.mdx` file. The change modifies the description to clarify the usage of `outline` utilities. * [`src/docs/outline-width.mdx`](diffhunk://#diff-a7a0467902b75954570708cc09d471f346011c3bce60b92e96aaa0c8b21f56daL22-R22): Changed "and" to "or" in the description to clarify that either `outline` or `outline-<number>` utilities can be used to set the width of an element's outline. --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Updated 2020-07-27:
This PR adds new
motion-reducedandmotion-safevariants that allow you to conditionally apply CSS based on theprefers-reduced-motionmedia feature.It can be useful in conjunction with transition and animation utilities to disable problematic motion for users who are sensitive to it:
...or to explicitly opt-in to motion to make sure it's only being shown to users who haven't opted out:
Generally I think
motion-safeis the better approach, but I've included both for completeness.These can be combined with responsive variants and pseudo-class variants as well:
This is the first example of "stackable" variants in Tailwind and is something we may expose to plugin authors in the future, but for now is just hardcoded for these core variants while we work out the internal details.