Error Template
interlace-ui/error-templateFreeBlock
Full-page error surface — 404 / 500 / 503 / generic. Centred column with the status code + title + description + action buttons (back home, contact support, retry).
Install it
npx shadcn@latest add https://ds.interlace.tools/r/error-template.jsonSource
1import * as React from 'react';23// @interlace/error-template v1.1.0 — Interlace design system.4// Docs, props and live preview: https://ds.interlace.tools/c/error-template5// What changed since: https://ds.interlace.tools/c/error-template#history6// Generated banner — keep it, the upgrade diff reads this version.78/**9 * @interlace/ui — ErrorTemplate10 *11 * Full-page error surface — 404 / 500 / 503 / generic. Centred column12 * with the status code + title + description + action buttons (back home,13 * contact support, retry).14 *15 * One template, four variants — pick via `variant`. Pass `actions` for16 * the CTA cluster.17 *18 * ## MIN_VIEWPORT — 32019 */2021import { cn } from '@/lib/utils';22import { Container } from '@/components/ui/container';23import { SectionBoundary } from '@/components/ui/section-boundary';24import { Stack } from '@/components/ui/stack';25import { Typography } from '@/components/ui/typography';26import { Skeleton } from '@/components/ui/skeleton';2728export const MIN_VIEWPORT = 320 as const;2930type ErrorVariant = '404' | '500' | '503' | 'generic';3132interface ErrorTemplateProps extends Omit<React.ComponentProps<'main'>, 'title'> {33 variant?: ErrorVariant;34 /** Override the default status code displayed. */35 statusCode?: React.ReactNode;36 /** Title. Defaults per `variant`. */37 title?: React.ReactNode;38 /** Description. Defaults per `variant`. */39 description?: React.ReactNode;40 /** Action button row (typically Back home + Contact). */41 actions?: React.ReactNode;42}4344const DEFAULTS: Record<45 ErrorVariant,46 { code: string; title: string; description: string }47> = {48 '404': {49 code: '404',50 title: 'Page not found',51 description:52 "We couldn't find the page you were looking for. It may have moved, or never existed.",53 },54 '500': {55 code: '500',56 title: 'Something went wrong',57 description:58 'An unexpected error occurred on our end. Try again, and if it keeps happening, let us know.',59 },60 '503': {61 code: '503',62 title: 'We\'ll be right back',63 description:64 'The site is undergoing maintenance. Please check back in a few minutes.',65 },66 generic: {67 code: '!',68 title: 'Something went wrong',69 description: 'An unexpected error occurred.',70 },71};7273function ErrorTemplate({74 variant = '404',75 statusCode,76 title,77 description,78 actions,79 className,80 ...props81}: ErrorTemplateProps) {82 const fallback = DEFAULTS[variant];83 return (84 <main85 data-slot="error-template"86// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Article Templatearticle-template | interlace-ui | Blocks | Free | no deps | |
| Auth Templateauth-template | interlace-ui | Blocks | Free | no deps | |
| Author Templateauthor-template | interlace-ui | Blocks | Free | no deps | |
| Blog Home Templateblog-home-template | interlace-ui | Blocks | Free | no deps | |
| Dashboard Templatedashboard-template | interlace-ui | Blocks | Free | no deps | |
| Docs Page Templatedocs-page-template | interlace-ui | Blocks | Free | no deps | |
| Landing Templatelanding-template | interlace-ui | Blocks | Free | no deps | |
| Registry Item Templateregistry-item-template | interlace-ui | Blocks | Free | no deps |
