"use client";
import { SitePreferencesProvider } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
accent | AccentPresetName | for visitors without a stored choice | Site accent preset (default for visitors without a stored choice). |
cookieDomain | CookieDomainOption | — | Domain of the theme and locale cookies: { shared: ".gtktsc.com" } shares them across that domain's sites and keeps them host-only anywhere else (localhost, preview hosts), resolved when a cookie is written; a string is used as is. |
locale | string | — | Current locale (usually from the URL). Uncontrolled when omitted. |
messages | LocaleProviderProps["messages"] | — | Message overrides (partial catalog or list), e.g. messages={pl} with import { pl } from "@pixxl-tools/components/locales/pl". Missing keys fall back to English; explicit component props always win. |
accentStorageKey | string | false | — | localStorage key for a visitor-chosen accent; false disables it. |
catalogs | LocaleProviderProps["catalogs"] | — | Catalogs by tag or language; the one for locale is used (see LocaleProvider). |
defaultLocale | string | — | Locale used when neither locale nor a stored preference is set. |
defaultTheme | ThemePreference | system | Theme without a stored choice. |
density | SiteDensity | — | Default density. |
densityStorageKey | string | false | — | localStorage key for a visitor-chosen density; false disables it. |
accentdefault for visitors without a stored choiceAccentPresetName
Site accent preset (default for visitors without a stored choice).
cookieDomainCookieDomainOption
Domain of the theme and locale cookies: { shared: ".gtktsc.com" } shares them across that domain's sites and keeps them host-only anywhere else (localhost, preview hosts), resolved when a cookie is written; a string is used as is.
localestring
Current locale (usually from the URL). Uncontrolled when omitted.
messagesLocaleProviderProps["messages"]
Message overrides (partial catalog or list), e.g. messages={pl} with import { pl } from "@pixxl-tools/components/locales/pl". Missing keys fall back to English; explicit component props always win.
accentStorageKeystring | false
localStorage key for a visitor-chosen accent; false disables it.
catalogsLocaleProviderProps["catalogs"]
Catalogs by tag or language; the one for locale is used (see LocaleProvider).
defaultLocalestring
Locale used when neither locale nor a stored preference is set.
defaultThemedefault systemThemePreference
Theme without a stored choice.
densitySiteDensity
Default density.
densityStorageKeystring | false
localStorage key for a visitor-chosen density; false disables it.
Theme: system · accent: blue
// app/[locale]/layout.tsx (Next App Router)
import type { ReactNode } from "react";
import { SitePreferencesProvider } from "@pixxl-tools/components";
import { pl } from "@pixxl-tools/components/locales/pl";
export default async function RootLayout({ children, params }: { children: ReactNode; params: Promise<{ locale: string }> }) {
const { locale } = await params;
return (
<html lang={locale} suppressHydrationWarning>
<body>
<SitePreferencesProvider accent="teal" cookieDomain=".example.com" locale={locale} messages={locale === "pl" ? pl : undefined}>
{children}
</SitePreferencesProvider>
</body>
</html>
);
}