Skip to content
synccn

Error Boundary

New

Catches render errors and shows a retry panel with details instead of a blank page. Resets on retry or resetKeys.

Revenue this month

$48,290

Errors sent to logging: 0

Installation

$ pnpm dlx shadcn@latest add @synccn/error-boundary

First time in this project? Connect synccn with one command.

Usage

import { ErrorBoundary, ErrorFallback } from "@/components/ui/error-boundary";<ErrorBoundary onError={report} resetKeys={[id]}><Widget /></ErrorBoundary>

API reference

Generated from the component's TypeScript types, so it always matches the code.

ErrorFallback

The default "Something went wrong" panel: message, retry and the stack trace behind a toggle.

  • errorrequired
    Error

    —

  • resetrequired
    () => void

    Clears the error and renders the children again.

  • title
    React.ReactNode

    Default "Something went wrong"

    Heading.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

  • The fallback is an alert, so it's announced when it replaces the content.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: alert
  • ARIA attributes: aria-expanded
  • Announces changes to screen readers