TanStack Start
Choose client bootstrap or cookie-based rendering in TanStack Start.
Install
Use an existing TanStack Start application.
Apply the appearance before hydration
Put the theme script in your root document's head. Keep your existing HeadContent, Scripts, and route setup.
Add suppressHydrationWarning to the root html element. Wrap your route content in the matching provider:
Use the same theme options and storage keys for the script and provider. Add your appearance and palette CSS, then use the React controls.
Render from a saved cookie
Choose cookie-based rendering when the server must know the saved preference. The helpers in uitheme-web/tanstack build the initial theme data, HTML attributes, and bootstrap script.
Create theme data separately for each request. Read and write cookies through your server functions. Pass the returned initial values to the provider and connect preference-change callbacks to your persistence code.
Start from the working server example below rather than sharing mutable theme state between requests. Check two requests with different cookies and reload each appearance.
Examples
- Client bootstrap example: root document script and client provider.
- Cookie-based server example: request-specific theme state and cookie persistence.

