Browse documentation
Reference / Transitions & animation
Fade animations
Animate opacity to introduce or dismiss an element while its layout stays in place. The fade presets run for 300ms by default.
Working example
Read the print note
Set in serif type on uncoated paper.
Use fade-out for the visual exit, then update the element’s visibility or DOM state if it should leave the page and keyboard order.
<details class="group rounded border p-4">
<summary class="cursor-pointer font-semibold">Read the print note</summary>
<p class="mt-3 origin-left motion-safe:group-open:animate-fade-in">Set in serif type on uncoated paper.</p>
</details>Class reference
| Class | CSS declarations |
|---|---|
animate-fade-in | animation: mono-fade-in 300ms ease-out both; |
animate-fade-out | animation: mono-fade-out 300ms ease-in both; |
animate-fill-both | animation-fill-mode: both; |
animate-duration-500 | animation-duration: 500ms; |
View full generated CSS
@keyframes mono-fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes mono-fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.animate-fade-in {
animation: mono-fade-in 300ms ease-out both;
}
.animate-fade-out {
animation: mono-fade-out 300ms ease-in both;
}
.animate-duration-500 {
animation-duration: 500ms;
}
.animate-fill-both {
animation-fill-mode: both;
}