# Error Boundary Component API A component that catches JavaScript errors in its child component tree. --- ## Installation ```toml # Cargo.toml [dependencies] shadcn-ui-leptos-error-boundary = "0.7" ``` ```rust use shadcn_ui_leptos_error_boundary::ErrorBoundary; ``` --- ## Component API ### ErrorBoundary | Prop | Type | Default | Description | |------|------|---------|-------------| | `fallback` | `Option>` | **Required** | Error fallback UI | | `children` | `Option` | `None` | Child components | --- ## Usage Examples ### Basic Error Boundary ```rust use leptos::prelude::*; use shadcn_ui_leptos_error_boundary::ErrorBoundary; #[component] pub fn MyComponent() -> impl IntoView { view! {

"Something went wrong"

"Please refresh the page"

} }) >

"Child content that might error"

} } ``` --- ## CSS Classes ```css .error-boundary { p-4 border border-destructive rounded-md } ``` --- ## TypeScript API ```typescript interface ErrorBoundaryProps { fallback: (error: Error) => React.ReactNode; children?: React.ReactNode; } export const ErrorBoundary: React.FC; ``` --- *Source: [packages/leptos/error-boundary/src/default.rs](https://github.com/yourusername/leptos-shadcn-ui/blob/main/packages/leptos/error-boundary/src/default.rs)*