Use the hook directly

Each button below calls useThemeAnimation on its own, with a different reveal: a circle, a blurred circle and a directional slide. Pick a slide direction, then toggle.

Circle Theme:
Blur Circle Theme:
Slide Theme:
Slide direction:

TanStack Start guide

How this is wired

  1. src/routes/__root.tsxRenders TanStackStartThemeScript in the head, so the theme class is on <html> before the page paints, and wraps the app in TanStackThemeProvider.
  2. vite.config.tsTurns on prerendering. Every route is written to static HTML at build time, so the guide needs no server.
  3. src/components/theme/ThemeToggle.tsxA toggle built on useThemeAnimation. The ref marks the button as the origin of the circle reveal.
  4. src/styles.cssLight, .dark and .theme-* variables. With systemThemeMode="css", a .system class follows the OS setting through a media query.