# Error Boundary

React error boundary with graceful terminal display



<ComponentPreview base="opentui" name="error-boundary-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-error-boundary
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="error-boundary" title="components/ui/error-boundary.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { ErrorBoundary } from "@/components/ui/error-boundary";
```

```tsx
<ErrorBoundary title="Application Error">
  <YourAppContent />
</ErrorBoundary>
```

API Reference [#api-reference]

ErrorBoundary [#errorboundary]

| Prop       | Type                                                       | Default    |
| ---------- | ---------------------------------------------------------- | ---------- |
| `children` | `ReactNode`                                                | `required` |
| `fallback` | `ReactNode`                                                | -          |
| `onError`  | `(error: Error, info: { componentStack: string }) => void` | -          |
| `title`    | `string`                                                   | `"Error"`  |
