Usage
import { ResultPage } from './ResultPage.jsx'
// After the action has finished on the server, show its result on its own page:
<ResultPage
locale="en"
variant={payment.ok ? 'success' : 'failure'}
title={payment.ok ? 'Invoice INV-2041 paid' : 'Payment for INV-2041 failed'}
details={[{ label: 'Amount', value: '$4,800.00' }, { label: 'Reference', value: 'INV-2041', copy: true }]}
continueIn={payment.ok ? 8 : 0} // seconds; 0 turns the countdown off
onContinue={() => router.push('/invoices/2041')}
onAction={async (which, variant) => {
if (which === 'primary' && variant === 'failure') return await payment.retry()
if (which === 'secondary') router.push('/invoices')
}}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text. |
variant | 'success' | 'failure' | 'success' | Which result to show. Only a success moves on by itself. |
loading | boolean | false | The action is still running: a spinner and a sentence, announced to screen readers. |
title / text / details | string / string / Array<{ label, value, copy? }> | — | Replace the shown variant’s title, sentence and facts. Write the title as object + action + result. |
continueIn | number | 8 | Seconds before a success continues by itself; 0 turns it off. A pointer or focus on the actions pauses it; "Stay here" stops it. |
onAction | (which: 'primary' | 'secondary', variant) => Promise<any> | void | — | A next action was pressed; the button waits while the promise runs. |
onContinue | () => void | — | The countdown reached zero. Without it, the primary action runs. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the block together with the components it is built from.
ResultPage.jsxresult-page.csscopy.jskit.jsxkit.cssui/base-button/ui/copy-button/ui/success-check/ui/spinner/tokens.cssREADME.md
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.