Error Boundary
Style-agnostic error boundary component.
Preview
The chart rendered normally.
Arguments
error_boundary(content='The chart rendered normally.')
Arguments
error_boundary(content='The chart rendered normally.', error='TimeoutError', fallback='The chart could not load.', retry_event='retry_load')
Usage
views.py
python
from djust import LiveView
from djust.components import ErrorBoundary
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ErrorBoundary(content='The chart rendered normally.')my_template.html
django
{{ component }}Parameters
| Name | Type | Default |
|---|---|---|
| fallback | str | 'Something went wrong' |
| error | str | '' |
| retry_event | str — renames the event; identity is `name` | '' |
| custom_class | str | '' |
| content | str | '' |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.error_boundary | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 5 of this component's classes at line 1929, 1930, 1931, 1932, 1933. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |