Skip to Content
Livery is in early development. Star us on GitHub!
PatternsOverview

Patterns

Guides for each quadrant of the usage matrix.

SSR + Static

Next.js with bundled themes (light/dark mode)

Server reads the user’s preference from a cookie and renders with the correct data-theme attribute. No flash.

Static Themes in Next.js →

SSR + Dynamic

Next.js with themes from a database or API

Server detects the tenant and fetches their theme. Each customer sees their own branding instantly.

CSR + Static

React SPA with bundled themes (light/dark mode)

Themes are bundled in your code. An init script runs before React to prevent flash.

Static Themes in React →

CSR + Dynamic

React SPA with themes from an API

Client fetches themes at runtime. Brief loading state while theme loads.

Dynamic Themes in React →

Quick Reference

PatternPackage(s)Key API
SSR + Static@livery/coretoCssStringAll(), data-theme
SSR + Dynamic@livery/core + @livery/reactcreateResolver(), toCssString()
CSR + Static@livery/core + @livery/reactcreateStaticThemeProvider(), getThemeInitScript()
CSR + Dynamic@livery/core + @livery/reactcreateDynamicThemeProvider(), createResolver()
Last updated on