QueryError
Data-fetch error state — renders an error Alert with an optional retry button.
Forwards ref through to the underlying Alert root <div role="alert">.
Install
Add the package and import the component.
pnpm add @hey-mike/tungstenpnpm add @hey-mike/tungstenimport { QueryError } from '@hey-mike/tungsten';import { QueryError } from '@hey-mike/tungsten';Preview
Same fixtures used by the visual-regression suite.
Usage
apps/docs/app/snapshots/query-error/page.tsx
import { QueryError } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function QueryErrorSnapshot() {
return (
<VariantGrid
title="QueryError"
variants={[
{ label: 'default', node: <QueryError message="Could not load data." /> },
]}
/>
);
}
import { QueryError } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function QueryErrorSnapshot() {
return (
<VariantGrid
title="QueryError"
variants={[
{ label: 'default', node: <QueryError message="Could not load data." /> },
]}
/>
);
}
Props
Surface specific to <QueryError />.
| Prop | Type | Default | Description |
|---|---|---|---|
| message | string | Something went wrong. Please try again. | — |
| title | string | Failed to load | — |
| onRetry | (() => void) | — | — |
| icon | ReactElement<unknown, string | JSXElementConstructor<any>> | null | — | Override the default error icon. Pass null to suppress the icon entirely. |