Command Palette

Search for a command to run...

Dev Tools/Error Boundary UI

Error Boundary UI

Error display component for React error boundaries with stack trace and retry

Open in v0Open in

Overview

An error display component designed for React error boundaries. Shows user-friendly messages in production and detailed stack traces in development, with retry and copy functionality.

Installation

bunx shadcn@latest add @elements/error-boundary-ui

Usage

import { ErrorBoundaryUi } from "@/components/elements/devtools/error-boundary-ui";

export function ErrorFallback({ error, resetErrorBoundary }) {
  return (
    <ErrorBoundaryUi
      error={error}
      resetError={resetErrorBoundary}
      isDev={process.env.NODE_ENV === "development"}
    />
  );
}

// With react-error-boundary
<ErrorBoundary FallbackComponent={ErrorFallback}>
  <App />
</ErrorBoundary>

Props

PropTypeDefaultDescription
errorError-Error object to display
resetError() => void-Callback to retry/reset
componentStackstring | null-React component stack trace
isDevbooleanNODE_ENV === "development"Show detailed info
classNamestring-Additional CSS classes

Development vs Production

Development mode:

  • Shows error name and full message
  • Expandable stack trace with parsed frames
  • Expandable component stack (if available)

Production mode:

  • Shows generic "Something went wrong" message
  • Hides technical details from users

Features

  • Dev/prod mode switching
  • Collapsible stack trace
  • Component stack display
  • Copy error to clipboard
  • Try again button
  • Parsed stack frames with file locations