Every hook is exported from @pixxl-tools/components and runs only in Client Components. Signatures and option tables on this page are generated from the TypeScript sources.
usePersistentThemeStores the theme preference (light, dark or system) in a cookie and localStorage (the cookie wins when both are set) and resolves system against prefers-color-scheme. With apply: true it also writes <html data-theme>; otherwise pair it with ThemeScript or ThemeProvider.
usePersistentTheme(options?: UsePersistentThemeOptions): UsePersistentThemeResult| Name | Type | Description |
|---|---|---|
apply | boolean | Also apply the preference: write it to <html data-theme> (what the CSS and <ThemeScript /> read) and the browser UI colour (themeColor) whenever it changes. Default false; leave it off when a SitePreferencesProvider, ThemeProvider or PixxlProvider theme owns the attribute. |
cookieDomain | CookieDomainOption | Cookie domain: { shared: ".gtktsc.com" } shares the preference across that domain's sites and stays host-only elsewhere (localhost, preview hosts); a string is used as is. Omit for a host-only cookie. |
cookieMaxAgeSeconds | number | — |
cookieName | string | false | Cookie name. Defaults to storageKey. Pass false to skip the cookie. Default: storageKey. |
enabled | boolean | Default true. false keeps the hook inert (no storage or cookie reads, no listeners) for a caller whose theme currently comes from elsewhere; setTheme still stores a choice. |
initialTheme | PersistentTheme | Value used for the server render and the first client render (keeps hydration stable). Defaults to system. Default: system. |
storageKey | string | localStorage key. Defaults to pixxl-theme. Default: pixxl-theme. |
themeColor | false | ThemeColors | With apply: theme-color for explicit choices (see ThemeScript). |
| Name | Type | Description |
|---|---|---|
resolvedTheme (required) | ResolvedTheme | theme with system resolved against prefers-color-scheme. |
setTheme (required) | (theme: PersistentTheme) => void | — |
theme (required) | PersistentTheme | The stored preference. |
const { theme, resolvedTheme, setTheme } = usePersistentTheme({
apply: true, // writes <html data-theme>; omit when a provider owns it
cookieDomain: { shared: ".example.com" }, // host-only on other hosts
storageKey: "theme",
});usePersistentThemeThe first render uses initialTheme (default system) on the server and the client, then reads storage after hydration, so markup never mismatches.
useSitePreferencesReads and updates the theme, accent, density and locale of the nearest SitePreferencesProvider. Returns null outside a provider.
useSitePreferences(): SitePreferences | null| Name | Type | Description |
|---|---|---|
locale (required) | string | — |
rememberLocale (required) | (locale: string) => void | Persists a locale (cookie + localStorage) without onLocaleChange: for a link that navigates by itself. LocaleSwitcher links call it through the provider automatically. |
resolvedTheme (required) | ResolvedTheme | — |
setAccent (required) | (accent: AccentPresetName | undefined) => void | undefined clears a stored choice (back to the provider default). |
setDensity (required) | (density: SiteDensity | undefined) => void | — |
setLocale (required) | (locale: string) => void | Persists the locale and calls onLocaleChange (navigate there). |
setTheme (required) | (theme: ThemePreference) => void | — |
theme (required) | ThemePreference | — |
accent | AccentPresetName | Effective accent: stored choice, else the provider's accent. |
density | SiteDensity | — |
const preferences = useSitePreferences();
preferences?.setAccent("violet");
preferences?.setDensity("compact");useSitePreferencesuseBreakpointMatches the shared breakpoints (sm 640, md 768, lg 1024, xl 1280 px), the same values the CSS uses. direction: "down" (default) is true below the breakpoint, "up" at or above it. Resize the window to see the values change.
useBreakpoint(breakpoint: PixxlBreakpoint, options?: boolean | UseBreakpointOptions): boolean| Name | Type | Description |
|---|---|---|
direction | BreakpointDirection | down (default): true below the breakpoint. up: true at or above it. Default: down. |
serverValue | boolean | Value used during SSR and the first client render. |
Returns boolean.
Live example
const isPhone = useBreakpoint("md"); // below 768 px
const isWide = useBreakpoint("lg", { direction: "up" });useBreakpointReturns serverValue (default false) during server rendering and hydration, then the real value.
useMediaQuerySubscribes to any media query with useSyncExternalStore.
useMediaQuery(query: string, serverValue?: boolean): booleanReturns boolean.
Live example
const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");useMediaQueryuseFloatingPositions a floating element next to a reference element or a point, with flip, shift, an optional arrow and right-to-left support. Popover, Tooltip, Menu and Combobox use it. Position updates are written to the DOM directly, so scrolling does not re-render React.
useFloating(options?: UseFloatingOptions): { refs: { arrow: RefObject<HTMLElement | null>; floating: RefObject<HTMLElement | null>; reference: RefObject<FloatingReference | null>; setArrow: (node: HTMLElement | null) => void; setFloating: (node: HTMLElement | null) => void; setReference: (node: FloatingReference | null) => void; }; update: () => void; }| Name | Type | Description |
|---|---|---|
arrowPadding | number | — |
flip | boolean | — |
offset | number | Gap between the reference and the floating element (default 8px). Default: 8px. |
open | boolean | Positioning runs only while open (default true). Default: true. |
padding | number | Distance kept from the viewport edges (default 8px). Default: 8px. |
placement | FloatingPlacement | Where it sits relative to its anchor (start/end follow the writing direction). |
shift | boolean | — |
| Name | Type | Description |
|---|---|---|
refs (required) | { arrow: RefObject<HTMLElement | null>; floating: RefObject<HTMLElement | null>; reference: RefObject<FloatingReference | null>; setArrow: (node: HTMLElement | null) => void; setFloating: (node: HTMLElement | null) => void; setReference: (node: FloatingReference | null) => void; } | — |
update (required) | () => void | — |
const { refs } = useFloating({ open, placement: "bottom-start", offset: 8 });
<button ref={refs.setReference}>Filters</button>
{open ? <div ref={refs.setFloating}>…</div> : null}useFloatinguseScrollLockLocks page scrolling while enabled is true. The scrollbar gutter is kept, so the page does not shift, and locks are reference-counted, so nested overlays release correctly.
useScrollLock(enabled?: boolean): voidReturns void.
useScrollLock(open);useScrollLockuseVirtualizerWindowing for long lists: renders only the visible rows plus overscan, with fixed or measured sizes and scrollToIndex. VirtualList and Combobox virtualize are built on it. The demo below scrolls through 10,000 rows.
useVirtualizer(options: UseVirtualizerOptions): { measureElement: (element: HTMLElement | null) => void; range: { end: number; start: number; }; scrollToIndex: (index: number, scrollOptions?: ScrollToIndexOptions) => void; totalSize: number; virtualItems: VirtualItem[]; }| Name | Type | Description |
|---|---|---|
count (required) | number | — |
itemSize (required) | VirtualItemSize | Fixed row size, or an estimate per index when measure is on (px). |
scrollRef (required) | RefObject<HTMLElement | null> | The scrolling element (ignored with windowScroll). |
enabled | boolean | Listen to scroll/resize only while enabled (e.g. while a popup is open). |
getItemKey | (index: number) => Key | — |
initialCount | number | Rows rendered before the viewport is known (SSR, first paint). |
keepIndex | number | An index that always stays rendered (active option, focused row). |
listRef | RefObject<HTMLElement | null> | Element whose top edge is item 0 (defaults to the scroll element). |
measure | boolean | Measure rendered rows (variable heights); pass measureElement as their ref. |
onRangeChange | (range: VirtualRange) => void | — |
overscan | number | Rows rendered beyond each edge of the viewport (default 4). Default: 4. |
windowScroll | boolean | Scroll with the page instead of a scroll container. |
| Name | Type | Description |
|---|---|---|
measureElement (required) | (element: HTMLElement | null) => void | — |
range (required) | { end: number; start: number; } | — |
scrollToIndex (required) | (index: number, scrollOptions?: ScrollToIndexOptions) => void | — |
totalSize (required) | number | — |
virtualItems (required) | VirtualItem[] | — |
Live example
const scrollRef = useRef<HTMLDivElement>(null);
const { totalSize, virtualItems } = useVirtualizer({ count, itemSize: 36, scrollRef });
<div ref={scrollRef} style={{ overflow: "auto" }}>
<div style={{ blockSize: totalSize, position: "relative" }}>
{virtualItems.map((item) => (
<Row key={item.key} style={{ position: "absolute", insetBlockStart: item.start }} />
))}
</div>
</div>useVirtualizerGive rows aria-setsize and aria-posinset, because only some of them are in the DOM.
useAsyncOptionsLoads Combobox options from a server: prefetch, on open or on type, with debounce, a minimum query length, paging (infinite), a TTL cache and cancellation of stale requests with AbortController. Spread comboboxProps on the Combobox.
useAsyncOptions<Option>(config: UseAsyncOptionsConfig<Option>): { comboboxProps: { hasMore: boolean; loadedCount: number; loading: boolean; loadingMore: boolean; onInputValueChange: (value: string, details: ComboboxInputChangeDetails) => void; onLoadMore: (() => void) | undefined; onOpenChange: (open: boolean) => void; onRetry: () => void; options: readonly Option[]; filter?: false | undefined; emptyLabel: string | undefined; error: boolean; }; error: unknown; hasMore: boolean; loadMore: () => void; loading: boolean; loadingMore: boolean; options: readonly Option[]; query: string; reload: () => void; requestCount: number; reset: () => void; setQuery: Dispatch<SetStateAction<string>>; }| Name | Type | Description |
|---|---|---|
loadOptions (required) | (query: string, context: LoadOptionsContext) => Promise<AsyncOptionsPage<Option>> | — |
cache | AsyncOptionsCache | Memoize results per query and page ({ ttl, max }, default off). |
debounceMs | number | Wait for typing to pause before requesting (ms, default 0). |
infinite | boolean | Load the next page when the end of the list is reached (default false: show a "refine" hint). Default: false. |
minQueryLength | number | Shortest query that triggers a request (default 0). Default: 0. |
mode | "onOpen" | "onType" | "prefetch" | When the first request runs: prefetch on mount, onOpen (default) the first time the list opens, onType only once the user types. Default: onOpen. |
pageSize | number | Results per request; a full page means hasMore. |
search | "local" | "remote" | remote (default): every query is a request. local: load once, filter in the Combobox. Default: remote. |
| Name | Type | Description |
|---|---|---|
comboboxProps (required) | { hasMore: boolean; loadedCount: number; loading: boolean; loadingMore: boolean; onInputValueChange: (value: string, details: ComboboxInputChangeDetails) => void; onLoadMore: (() => void) | undefined; onOpenChange: (open: boolean) => void; onRetry: () => void; options: readonly Option[]; filter?: false | undefined; emptyLabel: string | undefined; error: boolean; } | — |
error (required) | unknown | — |
hasMore (required) | boolean | — |
loading (required) | boolean | — |
loadingMore (required) | boolean | — |
loadMore (required) | () => void | — |
options (required) | readonly Option[] | Options to choose from. |
query (required) | string | — |
reload (required) | () => void | — |
requestCount (required) | number | — |
reset (required) | () => void | — |
setQuery (required) | Dispatch<SetStateAction<string>> | — |
const users = useAsyncOptions({
loadOptions: (query, { signal, offset, pageSize }) =>
searchUsers({ query, offset, pageSize, signal }),
mode: "onType",
debounceMs: 300,
cache: { ttl: 60_000 },
});
<Combobox {...users.comboboxProps} inputLabel="Assignee" />useAsyncOptionsuseRecentOptionsRemembers recently chosen options (deduplicated, newest first, synced across tabs) and returns them as a Combobox group.
useRecentOptions<Option>(config?: UseRecentOptionsConfig<Option>): { addRecent: (option: Option | null | undefined) => void; clearRecent: () => void; group: ComboboxGroup<Option> | null; recent: readonly Option[]; removeRecent: (value: string) => void; }| Name | Type | Description |
|---|---|---|
getOptionValue | (option: Option) => string | Identity used to de-duplicate (default option.value). Default: option.value. |
label | string | Group label (default from messages: "Recent"). Default: from messages: "Recent". |
max | number | Most recent items kept (default 5). Default: 5. |
storage | RecentOptionsStorage | null | Where to persist (default localStorage; null disables persistence). Default: localStorage. |
storageKey | string | Persist under this key; omit to keep recents in memory only. |
| Name | Type | Description |
|---|---|---|
addRecent (required) | (option: Option | null | undefined) => void | — |
clearRecent (required) | () => void | — |
group (required) | ComboboxGroup<Option> | null | — |
recent (required) | readonly Option[] | — |
removeRecent (required) | (value: string) => void | — |
const recent = useRecentOptions<User>({ storageKey: "recent-users", max: 5 });
<Combobox
options={recent.group ? [recent.group, ...users] : users}
onValueChange={(value, user) => recent.addRecent(user)}
/>useRecentOptionsuseStorageStoreReads a store made by createStorageStore, a value kept in localStorage (or sessionStorage with storage: "session") and shared by every component and tab that reads the same key. The server and the first client render use defaultValue, so hydration matches. Stored text goes through parse: return undefined (or throw) to reject it, e.g. a version the site no longer documents, and the default is used. When storage is blocked or full, set returns false and the value still applies for this page view; set(value, { persist: false }) does that on purpose, e.g. for a version taken from the URL. storage events from other tabs replace the value. The store itself (subscribe, getSnapshot, getServerSnapshot, set, reset) also works with useSyncExternalStore directly; create it once at module level in a client module.
useStorageStore<Value>(store: StorageStore<Value>): readonly [Value, (value: Value, options?: StorageStoreSetOptions) => boolean]| Name | Type | Description |
|---|---|---|
getServerSnapshot (required) | () => Value | The default value: what the server renders. |
getSnapshot (required) | () => Value | Current value (memory, then storage, then the default). |
key (required) | string | — |
reset (required) | () => void | Removes the stored value and any page-view value; subscribers see the default. |
set (required) | (value: Value, options?: StorageStoreSetOptions) => boolean | Sets the value and notifies subscribers in this tab. Returns true when it was written to storage, false when storage refused it (or persist was false); the value still applies to this page view. |
subscribe (required) | (listener: () => void) => () => void | useSyncExternalStore subscribe: this tab's changes and other tabs' storage events. |
Returns readonly [Value, (value: Value, options?: StorageStoreSetOptions) => boolean].
import { createStorageStore, useStorageStore } from "@pixxl-tools/components";
const versions = ["0.2", "0.3"];
// Module level: one store per key.
const versionStore = createStorageStore({
key: "library-version",
defaultValue: "0.3",
parse: (raw) => (versions.includes(raw) ? raw : undefined),
serialize: String,
});
export function VersionSelect() {
const [version, setVersion] = useStorageStore(versionStore);
return (
<Select
aria-label="Library version"
value={version}
onValueChange={(next) => setVersion(next)}
options={versions.map((value) => ({ label: value, value }))}
/>
);
}useStorageStoreValues that are not strings use JSON.parse/JSON.stringify by default; a parsed array or object stays the same reference until the stored text changes.
reset() removes the stored value and any page-view value.
useToastShows toasts from the nearest ToastProvider. The same API is available outside React as toast() (toast.success, toast.danger, toast.dismiss). Toasts are announced through persistent live regions and pause while hovered or focused.
useToast(): UseToastResult| Name | Type | Description |
|---|---|---|
dismiss (required) | (id?: string) => void | — |
toast (required) | ToastApi | — |
toasts (required) | readonly ToastRecord[] | — |
Live example
const { toast } = useToast();
toast.success({ title: "Saved", description: "All changes are stored." });
// outside components:
import { toast } from "@pixxl-tools/components";
toast("Copied");useToastuseClipboardCopies text with the async Clipboard API; supported is false where it is unavailable (for example on insecure origins). copied resets after resetDelayMs.
useClipboard(options?: UseClipboardOptions): UseClipboardResult| Name | Type | Description |
|---|---|---|
resetDelayMs | false | number | Back to idle after this many ms (default 2000); false keeps the state. Default: 2000. |
| Name | Type | Description |
|---|---|---|
copied (required) | boolean | — |
copy (required) | (value: string, anchor?: Element | null) => Promise<boolean> | Copies value (Clipboard API, then a legacy fallback that works inside modal dialogs). Resolves false on failure; never rejects. |
error (required) | unknown | The failure of the last copy, when it failed. |
reset (required) | () => void | — |
status (required) | ClipboardStatus | — |
supported (required) | boolean | false on the server and before hydration, then the real support. |
Live example
const { copied, copy } = useClipboard({ resetDelayMs: 2000 });useClipboarduseConsentShared analytics consent store (default key analytics-consent) used by ConsentBanner. status is unknown during server rendering and hydration, then unset, granted or denied; changes sync across components and tabs.
useConsent(options?: UseConsentOptions): UseConsentResult| Name | Type | Description |
|---|---|---|
cookieDomain | CookieDomainOption | Domain of the cookie mirror. { shared: ".gtktsc.com" } uses the shared domain only on that site and its subdomains (host-only on localhost and preview hosts); a string is used as is. |
cookieName | string | false | Cookie mirror name; false/unset keeps the decision in localStorage only. |
maxAgeDays | number | Ask again after this many days (default 365); Infinity never expires. Values stored without a timestamp (0.2) do not expire. Default: 365. |
onChange | (status: Exclude<ConsentStatus, "unknown">) => void | Called with the decision once it is known after hydration and on every later change — the place to load or disable analytics. |
storageKey | string | localStorage key (default analytics-consent). Default: analytics-consent. |
version | string | Policy version. A decision stored under another version (or none) is ignored, so changing it asks every visitor again. |
| Name | Type | Description |
|---|---|---|
closePreferences (required) | () => void | — |
deny (required) | () => void | — |
grant (required) | () => void | — |
open (required) | boolean | Whether the banner should be visible: unset, or reopened. |
openPreferences (required) | () => void | — |
reopened (required) | boolean | Preferences were reopened after a decision. |
reset (required) | () => void | Forget the decision (the banner shows again). |
status (required) | ConsentStatus | — |
const { status, grant, deny, openPreferences } = useConsent({
onChange: (next) => updateAnalytics(next === "granted"),
});useConsentuseInstallPromptCaptures beforeinstallprompt on Chromium browsers, detects iOS (which needs Add to Home Screen instructions) and remembers dismissal. InstallPrompt is built on it.
useInstallPrompt(options?: UseInstallPromptOptions): UseInstallPromptResult| Name | Type | Description |
|---|---|---|
remindAfterDays | number | Show again this many days after a dismissal (default: never). Default: never. |
storageKey | string | false | localStorage key for the dismissal time; false keeps it in memory. |
| Name | Type | Description |
|---|---|---|
dismiss (required) | () => void | — |
dismissed (required) | boolean | true once dismissed (persisted), until remindAfterDays pass. |
platform (required) | InstallPlatform | — |
promptInstall (required) | () => Promise<InstallOutcome> | Shows the browser install dialog (only on the prompt platform). |
const { platform, promptInstall, dismiss } = useInstallPrompt({ remindAfterDays: 30 });useInstallPromptuseOnlineStatusTracks navigator.onLine and the online/offline events. It returns true on the server.
useOnlineStatus(): booleanReturns boolean.
Live example
This browser is online
const online = useOnlineStatus();useOnlineStatususeUnsavedChangesWarningWhile active is true, the browser asks before the page is reloaded, closed or left through a full navigation (its own dialog; client-side router links do not unload the page). Pass true only while there is work to lose. The optional second argument runs as the page unloads, e.g. to write a pending autosave, and the browser asks only if it returns true. CandrawEditor uses it for warnOnUnsavedChanges.
useUnsavedChangesWarning(active: boolean, stillUnsaved?: () => boolean): voidReturns void.
const [text, setText] = useState(initialText);
useUnsavedChangesWarning(text !== initialText);useUnsavedChangesWarningdownloadBlobPlain functions, not hooks: downloadBlob(blob, fileName) and downloadText(text, fileName, { type }) save content made in the browser (Save to file, backups, exports) through a temporary <a download> and an object URL that is revoked 30 seconds after the click (DOWNLOAD_REVOKE_DELAY_MS), so Safari and Firefox finish the download. Call them from event handlers; importing them during server rendering is safe, and without a DOM they return false. For a file that already has a URL, render DownloadTrigger.
import { downloadBlob, downloadText } from "@pixxl-tools/components";
<Button onClick={() => downloadText(JSON.stringify(drawing), "drawing.json", { type: "application/json" })}>
Save to file
</Button>;
canvas.toBlob((png: Blob | null) => {
if (png) {
downloadBlob(png, "drawing.png");
}
});downloadBlobuseKeyboardShortcutsPage-wide shortcuts on window: keys are KeyboardEvent.key values (case-insensitive) with ctrl, alt, shift, meta or mod (⌘ on Apple platforms, Ctrl elsewhere). Shortcuts do not run while focus is in an editable control unless they are listed in inEditable, during IME composition, or for events another handler already prevented; a shortcut that runs prevents the default action (preventDefault: false keeps it). isTypingTarget(eventOrElement) is the same check for your own handlers: text-like inputs, textareas, selects, contenteditable and textbox, searchbox, combobox or spinbutton roles.
useKeyboardShortcuts(shortcuts: Readonly<Record<string, KeyboardShortcutHandler>>, options?: UseKeyboardShortcutsOptions): void| Name | Type | Description |
|---|---|---|
enabled | boolean | Default true. |
inEditable | readonly string[] | Shortcuts that also run while focus is in an editable control (e.g. ["Escape"]); all others are ignored there. |
preventDefault | boolean | Call preventDefault() when a shortcut runs (default true). Default: true. |
Returns void.
useKeyboardShortcuts(
{
"/": () => searchRef.current?.focus(),
"mod+k": () => setPaletteOpen(true),
Escape: () => setPaletteOpen(false),
},
{ inEditable: ["Escape"] },
);
window.addEventListener("keydown", (event) => {
if (!isTypingTarget(event) && event.key === " ") {
togglePlayback();
}
});useKeyboardShortcutsnegotiateLocaleA plain function, server-safe (proxy, middleware, route handlers): the stored choice when it is supported, else the first Accept-Language range that matches a supported locale (exact tag, then language), else defaultLocale (default: the first supported locale). The result uses the supported list’s own spelling. parseAcceptLanguage(header) returns the ranges by quality.
import { getLocaleFromCookie, negotiateLocale } from "@pixxl-tools/components/server";
export function proxy(request: NextRequest) {
const locale = negotiateLocale({
acceptLanguage: request.headers.get("accept-language"),
cookie: getLocaleFromCookie(request.headers.get("cookie")),
supportedLocales: ["en", "pl"],
});
// Redirect unprefixed paths to the negotiated locale.
return NextResponse.redirect(new URL(`/${locale}${request.nextUrl.pathname}`, request.url));
}negotiateLocaleusePixxlMessagesReturns the provider locale, direction, the complete message catalog and t(key, values) for your own UI. Plural messages pick the CLDR category from {count}. It bundles the whole English catalog (about 4 KB gzip), so client components that need a few strings use useMessage or useMessages with one namespace instead. The demo renders the same component under an English and a Polish provider.
usePixxlMessages(): PixxlTranslator| Name | Type | Description |
|---|---|---|
direction (required) | PixxlDirection | — |
locale (required) | string | — |
messages (required) | PixxlMessages | Complete catalog for the provider locale (English fills the gaps). |
t (required) | (key: PixxlMessageKey, values?: PixxlMessageValues) => string | Formats a message by id: t("dataTable.selected", { count: 3 }). |
Live example
const { t } = usePixxlMessages();
t("dataTable.selected", { count: 3 }); // "3 selected" / "3 zaznaczone wiersze"usePixxlMessagesuseMessageFormats one message by key. The second argument is the English strings of that namespace from @pixxl-tools/components/locales/en, so the client bundle carries one namespace, not the whole catalog.
useMessage<Key extends PixxlMessageKey>(key: Key, defaults: PixxlMessages[PixxlMessageKeyNamespace<Key>], values?: PixxlMessageValues): stringReturns string.
import { pagination } from "@pixxl-tools/components/locales/en";
const label = useMessage("pagination.next", pagination);useMessageuseMessagesA translator for one namespace, with its English strings as the fallback: provider messages first, then defaults. Each namespace is a named export of @pixxl-tools/components/locales/en (and of locales/pl), so unused namespaces tree-shake away.
useMessages<Namespace extends PixxlMessageNamespace>(namespace: Namespace, defaults: PixxlMessages[Namespace]): MessageTranslator<Namespace>Returns MessageTranslator<Namespace>.
import { notFoundPage } from "@pixxl-tools/components/locales/en";
const t = useMessages("notFoundPage", notFoundPage);
t("title"); // "Page not found" / "Nie znaleziono strony"useMessagesusePixxlLocaleReads the raw locale context: locale, direction, the resolved messages layers and catalogs. Most code wants usePixxlMessages instead.
usePixxlLocale(): PixxlLocaleContextValue| Name | Type | Description |
|---|---|---|
direction (required) | PixxlDirection | — |
locale (required) | string | Canonical BCP 47 locale (never empty, so SSR and hydration agree). |
messages (required) | PixxlMessagesInput | Messages resolved for locale (matching catalog + messages layers), without the built-in English defaults that components fall back to. |
overrides (required) | readonly PixxlMessagesInput[] | messages layers, inherited by nested providers of the same language. |
catalogs | PixxlMessageCatalogs | Catalogs by tag or language, inherited by nested providers. |
const { locale, direction } = usePixxlLocale();usePixxlLocale