Components
Error template
The pages people land on when something goes wrong, each with the way out that fits: search, ask for access, retry with a reference, wait out maintenance, reconnect or get a new link.
pnpm dlx shadcn@latest add @caliper/error-templateWhen to use
Use it for
- Your site's 404, 403, 500 and maintenance pages.
- Offline and expired-link screens in a web app.
Skip it when
- Errors inside a form or panel; show them where they happened.
Installation
pnpm dlx shadcn@latest add @caliper/error-template
Adds its 13 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
import { useState } from "react" import { FooterBlock } from "@/components/ui/footer-block" import { ErrorTemplate, type ErrorKind } from "@/components/ui/error-template" import { SegmentedControl } from "@/components/ui/segmented-control" const columns = (product: string[], company: string[] = ["About", "Careers", "Contact"], resources: string[] = ["Docs", "Changelog", "Status"]) => [ { title: "Product", links: product.map((label) => ({ label, href: "#" })) }, { title: "Resources", links: resources.map((label) => ({ label, href: "#" })) }, { title: "Company", links: company.map((label) => ({ label, href: "#" })) }, { title: "Legal", links: ["Privacy", "Terms", "DPA"].map((label) => ({ label, href: "#" })) }, ]; const footers: Parameters<typeof FooterBlock>[0] = { brand: "Halden", tagline: "Month-end close for finance teams. Lisbon and London.", columns: columns(["Matching", "Review", "Audit trail", "Pricing"]), newsletter: { label: "The close, monthly", note: "One email at month end. Unsubscribe in one click.", onSubmit: () => new Promise((resolve) => setTimeout(resolve, 600)) }, legal: "© 2026 Halden Ltd", status: { label: "All systems normal", href: "#" } }; const startTrial = { label: "Start the trial", href: "#" }; const nav = (current: string) => [ { label: "Product", href: "#product" }, { label: "Customers", href: "#customers" }, { label: "Blog", href: "#blog" }, { label: "About", href: "#about" }, { label: "Contact", href: "#contact" }, ].map((link) => ({ ...link, current: link.label.toLowerCase() === current })); const signIn = { label: "Sign in", href: "#" }; const frame = "h-[720px] w-full overflow-auto rounded-overlay border border-border shadow-resting"; const wait = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)); const kinds: { value: ErrorKind; label: string }[] = [ { value: "404", label: "404" }, { value: "403", label: "403" }, { value: "500", label: "500" }, { value: "503", label: "503" }, { value: "offline", label: "Offline" }, { value: "expired", label: "Expired" }, ]; export function ErrorPagesDemo() { const [kind, setKind] = useState<ErrorKind>("404"); const [online, setOnline] = useState(false); const [until] = useState(() => new Date(Date.now() + 25 * 60_000).toISOString()); const [searched, setSearched] = useState(""); return ( <div className="grid w-full gap-3"> <div className="flex flex-wrap items-center gap-3"> <div className="max-w-full overflow-x-auto [scrollbar-width:none]"> <SegmentedControl label="Error page" value={kind} onValueChange={(value) => setKind(value as ErrorKind)} options={kinds} /> </div> {kind === "offline" && ( <button type="button" className="text-[13px] underline underline-offset-2" onClick={() => setOnline((value) => !value)}> {online ? "Go offline again" : "Simulate reconnecting"} </button> )} {searched && kind === "404" && <span role="status" className="text-[13px] text-muted-foreground">Searched for “{searched}”</span>} </div> <div className={frame}> <ErrorTemplate key={kind} kind={kind} brand="Halden" nav={nav("")} signIn={signIn} primary={startTrial} actions={{ primary: { label: "Go to the home page", href: "#" }, secondary: { label: "Go back", href: "#" } }} suggestions={kind === "404" ? [ { label: "Pricing", href: "#pricing", description: "Plans for teams of every size" }, { label: "Changelog", href: "#changelog", description: "What shipped this week" }, { label: "Help centre", href: "#help", description: "Guides and answers" }, ] : []} onSearch={setSearched} signedInAs="dana@forma.studio" onRequestAccess={() => wait(700)} reference="ERR-7Q2K-91XD" onRetry={async () => { await wait(700); if (kind === "500") throw new Error("still down"); }} statusHref="#status" until={until} onResend={() => wait(600)} isOnline={online} footer={footers} /> </div> </div> ); }
API reference
ErrorTemplate
component
Accessibility
It exposes status and search semantics, with aria-hidden, aria-label and aria-labelledby kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion
Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.