import { GlobalErrorPage } from "@pixxl-tools/components";
// In Server Components:
import { GlobalErrorPage } from "@pixxl-tools/components/server";| Prop | Type | Default | Description |
|---|---|---|---|
error | Error & { digest?: string } | — | The error from a framework error boundary; digest is shown as a reference. |
reset | () => void | — | Retry callback (Next.js reset): renders a "Try again" button. |
themeScript | ThemeScriptProps | false | — | The site's ThemeScript settings (accent, cookie and storage keys), so the error page keeps the visitor's theme; false leaves it out. |
actions | ReactNode | — | Action slot (buttons or links). |
code | ReactNode | — | Short code above the title, e.g. 404 or 500. |
description | ReactNode | — | Supporting text. |
head | ReactNode | "en" | More <head> content (icons, a font preload…). |
headingAs | "h1" | "h2" | h1 | Heading level of the title (default h1). |
homeHref | string | false | / | Link of the default "Back to home" action (default /). |
homeLabel | ReactNode | — | — |
errorError & { digest?: string }
The error from a framework error boundary; digest is shown as a reference.
reset() => void
Retry callback (Next.js reset): renders a "Try again" button.
themeScriptThemeScriptProps | false
The site's ThemeScript settings (accent, cookie and storage keys), so the error page keeps the visitor's theme; false leaves it out.
actionsReactNode
Action slot (buttons or links).
codeReactNode
Short code above the title, e.g. 404 or 500.
descriptionReactNode
Supporting text.
headdefault "en"ReactNode
More <head> content (icons, a font preload…).
headingAsdefault h1"h1" | "h2"
Heading level of the title (default h1).
homeHrefdefault /string | false
Link of the default "Back to home" action (default /).
homeLabelReactNode
500
An unexpected error occurred. Try again, or go back to the home page.
Error reference: a1b2c3
"use client";
// app/global-error.tsx (import the site CSS too)
import { GlobalErrorPage } from "@pixxl-tools/components";
export default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
return <GlobalErrorPage error={error} reset={reset} themeScript={{ accent: "teal" }} />;
}