Browse documentation

Reference / Transitions & animation

Animation play state

Pause at the current frame and resume from the same point. The play state can follow a native checkbox.

Working example

Uncheck the control to hold the current rotation. With reduced motion enabled the indicator stays still.

HTML
<label class="block">
  <input type="checkbox" class="peer accent-black"> Run the indicator
  <span aria-hidden="true" class="mt-3 block size-7 rounded-full border-2 border-black border-t-transparent motion-safe:animate-spin motion-safe:animate-play-paused motion-safe:peer-checked:animate-play-running"></span>
</label>

Class reference

ClassCSS declarations
animate-play-pausedanimation-play-state: paused;
animate-play-runninganimation-play-state: running;
peer-checked:animate-play-runninganimation-play-state: running;
View full generated CSS
Compiled CSS
.animate-play-paused {
  animation-play-state: paused;
}
.animate-play-running {
  animation-play-state: running;
}
:where(.peer:checked) ~ .peer-checked\:animate-play-running {
  animation-play-state: running;
}