Error State
A centred message for a failed load, with an optional retry.
Something went wrong
We couldn't load your invoices.
import { ErrorState } from "@dapplelight/signet-ui/components/error-state"
export function Demo() {
return <ErrorState message="We couldn't load your invoices." onRetry={() => {}} />
}Installation
npm i @dapplelight/signet-uiUsage
import { ErrorState } from "@dapplelight/signet-ui/components/error-state"
import { refetch } from "./actions"
<ErrorState message="Could not load invoices." onRetry={refetch} />Examples
Retry
Something went wrong
Request timed out. Retried 0 times.
import { useState } from "react"
import { ErrorState } from "@dapplelight/signet-ui/components/error-state"
export function Demo() {
const [tries, setTries] = useState(0)
return (
<ErrorState
message={`Request timed out. Retried ${tries} time${tries === 1 ? "" : "s"}.`}
onRetry={() => setTries((n) => n + 1)}
/>
)
}Without message
Something went wrong
import { ErrorState } from "@dapplelight/signet-ui/components/error-state"
export function Demo() {
return <ErrorState />
}API Reference
ErrorState
Renders with role="alert". The heading and button text come from the labels provider (somethingWentWrong, tryAgain).
| Prop | Type | Default | Description |
|---|---|---|---|
message | string | none | Detail under the heading. |
onRetry | () => void | none | Shows a retry button when set. |