-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
CSS Transitions #378
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
CSS Transitions #378
Conversation
Transitions are a necessary feature. I have some feedback though. Isn't |
Sure, I’m definitely open to calling it |
I would think everything is accessible with one or two letters only when unclear the full so maybe |
Don't know... Widths, margins and paddings are easily accessible with very few letters because you use them very often, and once you learn the shorthand, you never forget it. Transitions are not the same thing in my opinion. They are more similar to borders: you don't use them that much, so it doesn't bother you to write it down in full. On the other hand, it does bother you having to learn a new abbreviation or having to take a look at the documentation everytime you forget what the said abbreviation is.
|
I agree with @fedetibaldo. If it's going to be abbreviated, I think |
I just updated the PR. There was one other place where I would like feedback on. The timing function classes right now are: .trans-linear
.trans-ease
.trans-in // ease-in
.trans-out // ease-out
.trans-in-out // ease-in-out I could see an argument for: .linear
.ease
.ease-in
.ease-out
.ease-in-out Thoughts? |
What do you mean by the second snippet? Dropping the In either case, I'm really against dropping the prefix when talking about something related to transitions. The |
Well, the transition timing function names are pretty unique, so they don't necessarily need to be prefixed. So you could do something like: <div class="trans ease-in-out">This will transition using the ease-in-out timing function.</div> Versus (with prefix, but shorter class names): <div class="trans trans-in-out">This will transition using the ease-in-out timing function.</div> Versus (the most verbose): <div class="trans trans-ease-in-out">This will transition using the ease-in-out timing function.</div> |
The trans prefix is needed because maybe later an |
@TVke good point. How do y'all feel about |
I prefer the verbose style |
Yeah, I convinced myself. Updated the PR. Here's the current summary of generated utilities: // Default
.trans {
transition-duration: .25s;
transition-property: all;
transition-timing-function: ease-in-out;
}
// Duration
.trans-slower { transition-duration: .75s; }
.trans-slow { transition-duration: .5s; }
.trans-fast { transition-duration: .15s; }
.trans-faster { transition-duration: .075s; }
// Properties
.trans-all { transition-property: all; }
.trans-none { transition-property: none; }
.trans-bg { transition-property: background; }
.trans-opacity { transition-property: opacity; }
.trans-color { transition-property: color; }
.trans-shadow { transition-property: box-shadow; }
// Timing Function
.trans-linear { transition-timing-function: linear; }
.trans-ease { transition-timing-function: ease; }
.trans-ease-in { transition-timing-function: ease-in; }
.trans-ease-out { transition-timing-function: ease-out; }
.trans-ease-in-out { transition-timing-function: ease-in-out; } |
@inxilpro quick question what about |
You have point. If we are going to implement transitions, adding all the properties would make sense. .trans-delay-none {
transition-delay: unset;
}
.trans-delay-1s {
transition-delay: 1s;
} In my opinion, |
Sure. Added: .trans-delay { transition-delay: 100ms; }
.trans-delay-long { transition-delay: 200ms; }
.trans-delay-longer { transition-delay: 300ms; }
.trans-delay-longest { transition-delay: 400ms; }
.trans-delay-none { transition-delay: unset; } (Updated to reflect shorter delays). |
I thought I'd add a few variants so you could do something like: <div class="group">
<div class="trans trans-delay group-hover:bg-grey">1</div>
<div class="trans trans-delay-longer group-hover:bg-grey">2</div>
<div class="trans trans-delay-long group-hover:bg-grey">3</div>
</div> …if you wanted the backgrounds to fade in with a little variation. I'm not sure that the |
Can't wait for this PR! Good job! Just a question. Why use |
I don't know if Adam has reviewed this yet (at least he hasn't commented), so I'd say you should ask for his oppinion on the current changes before adding more things... |
Hey all! Haven't chimed in on this PR because I've been focused on getting the plugin system out the door. I'd really like to get transitions into core eventually but I'm not ready to really dig into it to make sure we nail it before getting it into a release right away. @inxilpro What do you think about releasing this as a plugin in the mean time so it can be iterated on separate from the framework itself, and once it feels like the API is perfect we can transition it into core? I'll be tagging 0.5.0 with the plugin system this afternoon. |
@adamwathan Sure, I'm game. Any plans for an official plugin list/repo/etc? |
Here's a basic plugin — anyone want to give it a shot? |
@inxilpro Cool! Sorry I should have mentioned this but the plugin system that's currently available in 0.4.3 won't work quite the same way in 0.5.0, namely the I'm just working on the release notes/upgrade guide for 0.5.0 right now and will be tagging it shortly. |
@adamwathan Got it. Updated the plugin to reflect those changes. Basically, just |
I am hesitant about the Personally, I like no prefix and /** duration */
.quicker { transition-duration: .1s; }
.quick { transition-duration: .2s; }
.slow { transition-duration: .5s; }
/** timing-function */
.linear { transition-timing-function: linear; }
.ease { transition-timing-function: ease; }
.ease-in { transition-timing-function: ease-in; }
.ease-out { transition-timing-function: ease-out; }
.ease-in-out { transition-timing-function: ease-in-out; }
/** delay */
.delay-short { transition-delay: .1s; }
.delay-long { transition-delay: .2s; }
/** property */
.props-all { transition-property: all; }
.props-transform { transition-property: transform; }
.props-colors { transition-property: background-color, color; }
.props-color { transition-property: color; }
.props-bg { transition-property: background-color; } This approach is also problematic as the durations, timing-functions, and delays would all have corresponding conflicts with As much as I dislike it, |
@knowler You can configure it however you want. Just install the plugin from https://github.com/glhd/tailwindcss-plugins |
why isn't this getting implemented? |
Not to be too annoying, but @adamwathan why is this not implemented yet? |
Because I haven't made the time to work through it yet. Use the plugin if you want the functionality from this PR right now, that's what the plugin system is for? |
@ricricucit let me know if you need any help getting the plugin working. And @adamwathan — let me know if there’s anything I can do to help, although I imagine it’s just a matter of time, which I sadly can’t help with :) No rush on my part. |
There is only the docs part left right? |
Please, fix conflicts and merge branch |
@adamwathan hey how are you doing? |
Something isn't sitting right with me using |
Yeah, I agree. I’m pretty sure Adam has planned to tackle this after the 1.0 release, so I just decided to leave it as-is. I’m happy to update it again to better match the plugin, but I’m going to wait until we hear something from Adam about what he’s thinking. |
There are other CSS properties like |
Ok sorry I then have misunderstood the reasoning. I have deleted my comment. |
Just a though. Instead of
How about something like
This keeps follows the convention with font-weight & colors while keeping flexibility. |
Figured I'd throw in my $0.02. I'm currently working with the following, taking inspiration from {
durations: {
shorter: '250ms',
short: '500ms',
normal: '1000ms',
long: '2000ms',
longer: '3000ms'
},
easing: {
normal: 'ease',
in: 'ease-in',
out: 'ease-out',
'in-out': 'ease-in-out',
linear: 'linear',
start: 'step-start',
end: 'step-end'
},
transitionDelay: theme => theme('durations'),
transitionDuration: theme => theme('durations'),
transitionTimingFunction: theme => theme('easing')
} .delay-shorter: { transition-delay: 250ms; }
.delay-short: { transition-delay: 500ms; }
.delay-normal: { transition-delay: 1000ms; }
.delay-long: { transition-delay: 2000ms; }
.delay-longer: { transition-delay: 3000ms; }
.duration-shorter: { transition-duration: 250ms; }
.duration-short: { transition-duration: 500ms; }
.duration-normal: { transition-duration: 1000ms; }
.duration-long: { transition-duration: 2000ms; }
.duration-longer: { transition-duration: 3000ms; }
.easing-normal: { transition-timing-function: ease; }
.easing-in: { transition-timing-function: ease-in; }
.easing-out: { transition-timing-function: ease-out; }
.easing-in-out: { transition-timing-function: ease-in-out; }
.easing-linear: { transition-timing-function: linear; }
.easing-start: { transition-timing-function: step-start; }
.easing-end: { transition-timing-function: step-end; } So far, it's working fine, especially for custom timing functions (e.g., A word on animations: since there are Edit: Including animation utility classes alongside transitions (as mentioned above) has been making a lot of sense. Even if you have to write the {
durations: {
ms: '1ms',
'0': '0',
'1': '50ms',
'2': '100ms',
'3': '150ms',
'4': '200ms',
'5': '250ms',
'6': '300ms',
'8': '400ms',
'10': '500ms',
'12': '600ms',
'16': '800ms',
'20': '1000ms',
'24': '1200ms',
'32': '1600ms',
'40': '2000ms',
'48': '2400ms',
'56': '2800ms',
'64': '3200ms',
}
} So the classes would be more like |
Will there be any option for case where I wan to hover on card itself but trigger transition animation on some div inside card? |
That's what group variants are for. You can use core's Also don't expect this PR to get merged. Adam's been working on his own transitions plugin which should be out they release TailwindUI if I didn't miss anything 👍 |
That's what I'm waiting for, it doesn't make sense to create something like that if Adam is working on this already... :) |
Superseded by #1273, sorry for not at least getting this merged in and basing my work off of that :/ Really appreciate the contribution either way. |
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request. ### What changed? #### ✳️ @tailwindcss/typography (0.5.16 → 0.5.19) · [Repo](https://github.com/tailwindlabs/tailwindcss-typography) · [Changelog](https://github.com/tailwindlabs/tailwindcss-typography/blob/main/CHANGELOG.md) <details> <summary>Release Notes</summary> <h4><a href="https://github.com/tailwindlabs/tailwindcss-typography/releases/tag/v0.5.19">0.5.19</a></h4> <blockquote><h3 dir="auto">Fixed</h3> <ul dir="auto"> <li>Fixed broken color styles (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/405">#405</a>)</li> </ul></blockquote> <h4><a href="https://github.com/tailwindlabs/tailwindcss-typography/releases/tag/v0.5.18">0.5.18</a></h4> <blockquote><h3 dir="auto">Fixed</h3> <ul dir="auto"> <li>Fixed undefined variable error (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/403">#403</a>)</li> </ul></blockquote> <h4><a href="https://github.com/tailwindlabs/tailwindcss-typography/releases/tag/v0.5.17">0.5.17</a></h4> <blockquote><h3 dir="auto">Added</h3> <ul dir="auto"> <li>Add modifiers for description list elements (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/357">#357</a>)</li> <li>Add <code class="notranslate">prose-picture</code> modifier (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/367">#367</a>)</li> </ul> <h3 dir="auto">Fixed</h3> <ul dir="auto"> <li>Include unit in <code class="notranslate">hr</code> border-width value (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/379">#379</a>)</li> <li>Ensure <code class="notranslate"><kbd></code> styles work with Tailwind CSS v4 (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/387">#387</a>)</li> </ul> <h3 dir="auto">Changed</h3> <ul dir="auto"> <li>Remove lodash dependencies (<a href="https://bounce.depfu.com/github.com/tailwindlabs/tailwindcss-typography/pull/402">#402</a>)</li> </ul></blockquote> <p><em>Does any of this look wrong? <a href="https://depfu.com/packages/npm/@tailwindcss%2Ftypography/feedback">Please let us know.</a></em></p> </details> <details> <summary>Commits</summary> <p><a href="https://github.com/tailwindlabs/tailwindcss-typography/compare/39d20e194940903046f2e2733ce0a9b59ccd464b...e002ab89ad8f4202638249c1c300c0cf0b3739c5">See the full diff on Github</a>. The new version differs by 22 commits:</p> <ul> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/e002ab89ad8f4202638249c1c300c0cf0b3739c5"><code>0.5.19</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/bbb1c21099e34ff4d1d7f82f7528b85e71ed3c5a"><code>Fix bad RGB syntax (#405)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/b316f958af5bc12a981526c3091d8319626e274e"><code>0.5.18</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/ed952066e698dbb65a2f082eeb903ccba5a6834a"><code>Fix variable declaration in opacity function (#403)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/7efcb4a499e6ede67088e28393a906d4d089e580"><code>0.5.17</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/e0ec248bafa002d589509e29bfd9f054570e6d85"><code>chore(ci): update actions for release insiders</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/511afcb0bd9732eb8fcdc703f35ff76e57bfcd7b"><code>Add modifiers for description list elements (#357)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/042a531528cd3ddecafda94fe972394dc8aab6ae"><code>Add `prose-picture` modifiers (#367)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/f822222ae6e289e8cc0b23636891dc3545d5682a"><code>Fix `kbd` shadow colors not being calculated on oklch colors (#387)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/ecb7e87a52d86afbbff64200d40f05fe59433039"><code>Add Tailwind v4 custom color theme example to README (#396)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/ecb7d5c435fbdf907a1224a453539143c802a75c"><code>Remove lodash dependencies (#402)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/b7cdf1e1ec98381e337800bc78863c0bbc72d6a5"><code>Clarify 'not-prose' usage when using prefixes (#399)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/25051fbfd7c7058708233b1b4c6280f039e5855d"><code>Fix syntax highlighting in readme</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/d3c1fbdc604902bc20049ce936d1410adbd6771c"><code>Include v3 installation instructions alongside v4 (#388)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/632970e3ce6fc10d1bfd8fb46cc9083d0d32986d"><code>Readme: Remove unused `{theme}` (#385)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/c92dc1c120f71d402a54becd6958af692ff426dd"><code>Fix typo in comments (#378)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/3e75cb04808f80b0e30b8c6fad2e4212917b194f"><code>Change the borderTopWidth value for hr from integer to a pixel value (#379)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/1a6972e6902df5ff63c85399e0418cbfce7855fb"><code>Rectify variant order Closes #376</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/0ab25dc0ff97505a75c966d3f9a020cd8a543ceb"><code>Fix plugin import path in README.md (#382)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/fb252ece730f228dfc9ae1c61de79c3ac0025d5c"><code>Fix syntax errors in Readme.md (#381)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/43a4c2c2fa1932a9b39f84188b2a6bef6e1a0131"><code>Update README for Tailwind CSS v4 (#380)</code></a></li> <li><a href="https://github.com/tailwindlabs/tailwindcss-typography/commit/d1e6421d4c07c15b3e1db6b6b10549df96fb129d"><code>Update README.md</code></a></li> </ul> </details> ---  [Depfu](https://depfu.com) will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with `@depfu rebase`. <details><summary>All Depfu comment commands</summary> <blockquote><dl> <dt>@depfu rebase</dt><dd>Rebases against your default branch and redoes this update</dd> <dt>@depfu recreate</dt><dd>Recreates this PR, overwriting any edits that you've made to it</dd> <dt>@depfu merge</dt><dd>Merges this PR once your tests are passing and conflicts are resolved</dd> <dt>@depfu cancel merge</dt><dd>Cancels automatic merging of this PR</dd> <dt>@depfu close</dt><dd>Closes this PR and deletes the branch</dd> <dt>@depfu reopen</dt><dd>Restores the branch and reopens this PR (if it's closed)</dd> <dt>@depfu pause</dt><dd>Ignores all future updates for this dependency and closes this PR</dd> <dt>@depfu pause [minor|major]</dt><dd>Ignores all future minor/major updates for this dependency and closes this PR</dd> <dt>@depfu resume</dt><dd>Future versions of this dependency will create PRs again (leaves this PR as is)</dd> </dl></blockquote> </details> Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
This PR introduces a handful of CSS transition utilities. See the discussion at #14. It's mostly just a few new generators and updated docs/tests/etc, but it also includes a fix to the
variants-and-disabling
partial that allows for no variants.