AI CSS Animations

Premium

Tumbling Cube Toggle

The knob is a cube that tumbles twice over its leading edge, pivoting on each real edge in turn: OFF, a blank face, then ON. Each landing squashes it a touch and its contact shadow sharpens.

Also known as: rolling cube toggle, 3d cube toggle switch css, tumbling dice switch, cube roll animation toggle.

Premium

Unlock the HTML and CSS

Everything you see above is live. Basic and Pro include every premium piece, with the HTML and CSS ready to copy, plus the Tailwind version where there is one and Motions in Claude Code on Pro.

Customizing this snippet

  • Color: set --tgl-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --tgl-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 24px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar toggle switches