CentercodeDitto
DittoPorygonAPI

ErrorCard

Unified error display for 404, 403, error boundaries, and custom errors

Overview

ErrorCard is a unified error display component that works with LayoutCard to create consistent, branded error experiences. Use the type prop for common scenarios, or customize with props for specific needs.

Error Types

  • type="error" - Error boundaries with Try Again + Go Home
  • type="404" - Not found pages with logo + Go Back + Go Home
  • type="403" - Access denied with lock icon + Go Back + Go Home
  • Custom - Use props directly for other scenarios

Type Presets

type="error"

For error.tsx error boundaries with Try Again action.

Something Went Wrong
An unexpected error occurred. Please try again.
Go Home

type="404"

For not-found.tsx 404 pages with logo.

Logo
Page Not Found
The page you're looking for doesn't exist or has been moved.
Go BackGo Home

type="404" (No i18n)

With noI18n prop for root-level pages outside locale context.

Logo
Well, This Is Awkward
That page isn't here.
Go BackHome

type="403"

For 403 access denied pages with warning lock icon.

Hold Up
You need a different access level to view this page.
Go BackGo Home

Custom Variants

Default Variant

Custom icon and text with default (primary) color.

Feature Coming Soon
This feature is not yet available. We're working hard to bring it to you.
Learn More

Destructive Variant

Destructive variant for critical errors.

Server Error
Something went wrong on our end. Please try again later.
Contact Support

Warning Variant

Warning variant for session/auth issues.

Session Expired
Your session has expired. Please log in again to continue.
Log In

Props Reference

ErrorCardProps

PropTypeDefaultDescription
type'error' | '404' | '403'-Preset type - sets icon, colors, and default text
iconIconDefinition-Custom icon (overrides type preset)
iconVariant'default' | 'destructive' | 'warning''default'Icon color variant
logostring-Logo image source (overrides icon)
logoAltstring-Logo alt text
titlestring-Custom title (overrides type preset)
descriptionstring-Custom description (overrides type preset)
reset() => void-Reset function for error boundaries (type="error")
primaryActionErrorCardAction-Custom primary action (overrides type preset)
secondaryActionErrorCardAction-Custom secondary action (overrides type preset)
noI18nErrorCardNoI18nStrings-Strings for use outside i18n context (root not-found.tsx)
devInfostring-Development-only info (error messages, denial reasons)

Usage

Basic Usage

import { LayoutCard } from '@/ui/layouts';
import { ErrorCard } from '@/ui/components';

// 404 page
<LayoutCard>
  <ErrorCard type="404" />
</LayoutCard>

// Error boundary
<LayoutCard>
  <ErrorCard type="error" reset={reset} />
</LayoutCard>

// Access denied
<LayoutCard>
  <ErrorCard type="403" />
</LayoutCard>

// Custom error
<LayoutCard>
  <ErrorCard
    icon={faRocket}
    iconVariant="warning"
    title="Custom Title"
    description="Custom message"
    primaryAction={{ label: "Action", href: "/" }}
  />
</LayoutCard>

Error Boundary (error.tsx)

// In app/error.tsx
'use client';
import { LayoutCard } from '@/ui/layouts';
import { ErrorCard } from '@/ui/components';

export default function Error({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  return (
    <LayoutCard>
      <ErrorCard type="error" reset={reset} />
    </LayoutCard>
  );
}

Not Found (not-found.tsx)

// In app/not-found.tsx (root - no i18n)
'use client';
import { LayoutCard } from '@/ui/layouts';
import { ErrorCard } from '@/ui/components';

export default function NotFound() {
  return (
    <LayoutCard>
      <ErrorCard
        type="404"
        noI18n={{
          title: "Well, This Is Awkward",
          description: "That page isn't here.",
          primaryLabel: "Go Back",
          secondaryLabel: "Home",
          logoAlt: "Logo",
        }}
      />
    </LayoutCard>
  );
}