Result
Operation results: success, warning, error and pages 403/404/500.
When to use
Result shows the final status of the page or operation with further actions: send success, error, no access or not found page. For a small local alert inside a work form, use Alert.
Statuses and contents of the result
status selects success/error/info/warning or 403/404/500. title reports the result, subTitle explains it, children contains details, extra contains further actions. Scopes accept values, Svelte snippets, and content arrays; boolean/null do not output text.
| Problem | Setting | Example |
|---|---|---|
| Confirm completion | status="success" |
Successful result |
| Explain the error and fix | status="error", children |
Reasons for the error |
| Show no access | status="403" |
No access |
| Show page not found | status="404" |
Not found |
| Report server failure | status="500" |
Crash |
| Replace regular icon | icon snippet |
Your own illustration |
| Return to form correction | application status | Submitting an application |
For 403/404/500, standard illustrations take precedence over icons. If you need your own icon, use the usual semantic status and snippet. null/false hide the regular icon.
Application actions and state
Result does not submit a request, store the form, or trigger a replay automatically. extra buttons belong to the application. After an error, save the entered data, explain the reason and give a path to correction or repetition.
Status 404 only changes the interface. HTTP status, route error handling, and data access are defined by the application. Result with 403 also does not replace rights checking.
In applied example, form and outcome are linked by a common model. Once completed, the focus moves to the result; returning to edit saves the values. This transition needs to be explicitly designed, especially if the submit button is removed from the DOM.
Headings, semantic styles and theme
headingLevel sets the heading level, default is 2. Select it according to the page structure. If necessary, set aria-label/aria-labelledby/aria-describedby for the entire area. Actions should remain native buttons or real links.
ConfigProvider.result sets the general class/style and semantic defaults. Root/title/subTitle/body/extra/icon are designed as an object or callback with the current props. styles - CSS strings; local values take precedence.
Result design tokens set the size of the title, caption, icon and indentation actions. Exception illustrations and regular icons use different compositions; the icon size token does not replace the 404 image. bind:nativeElement provides a root div after the mount.
A non-empty local prefixCls specifies the CSS classes of Result and its nodes. The empty string and undefined inherit ConfigProvider.prefixCls with the -result suffix, defaulting to ant-result. Content, semantic styles and namespace CSS variables are preserved. Example of a common prefix includes Result with status success.
Examples
Success
Completed publication and transition to review.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="success" title={("Project published")} subTitle={("Components and documentation are available to visitors.")} extra={(extra)} headingLevel={4} />
Information
The request has been accepted for processing.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="info" title={("Request accepted")} subTitle={("The result will appear after processing.")} extra={(extra)} headingLevel={4} />
Warning
Additional verification required.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="warning" title={("Need additional verification")} subTitle={("Please check your settings before publishing.")} extra={(extra)} headingLevel={4} />
403 - no access
Standard illustration of exception.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="403" title={("403")} subTitle={("You do not have access to this section.")} extra={(extra)} headingLevel={4} />
404 - page not found
Standard missing page illustration.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="404" title={("404")} subTitle={("The requested page was not found.")} extra={(extra)} headingLevel={4} />
500 - server error
Standard failure illustration.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to component overview")}</Button>{/snippet}
<Result status="500" title={("500")} subTitle={("Failed to process the request. Please try again later.")} extra={(extra)} headingLevel={4} />
Application not accepted
Check the following information:
- Member name must not be empty.
- A valid email address is required.
Error details
List of reasons and proceed to editing the application.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
</script>
<style>
p { margin: 0 0 16px; }
ul {
padding-inline-start: 20px;
margin: 0;
}
li + li { margin-top: 12px; }
</style>
{#snippet extra()}
<Button type="primary" href={("#result-demo-application")}>
{("Check application")}
</Button>
{/snippet}
<Result status="error" title={("Application not accepted")} subTitle={("Correct the data and resend.")}
extra={(extra)} headingLevel={4}>
<p>{("Check the following information:")}</p>
<ul><li>
{("Member name must not be empty.")}
</li><li>
{("A valid email address is required.")}
</li></ul>
</Result>
Check completed
Text only
Own icon and action
Snippet, hidden icon and button handler.
<script lang="ts">
import { Button, Result } from '@woodger/antd';
let count = $state(0);
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
</style>
{#snippet icon()}<svg width="72" height="72" viewBox="0 0 72 72" aria-hidden="true">
<rect x="8" y="8" width="56" height="56" rx="14" fill="#fff1b8" />
<path d="m22 36 9 9 19-20" fill="none" stroke="#ad6800" stroke-width="5" />
</svg>{/snippet}
{#snippet extra()}
<Button type="primary" onclick={() => { count++; }}>
{("Confirm result")}
</Button>
{/snippet}
<div class="examples">
<Result
title={("Check completed")}
{icon}
extra={(extra)}
headingLevel={4}
/>
<Result status="info" title={("Text only")} icon={null} headingLevel={4} />
<output
aria-label={("Confirmation Result")}
>{("Confirmed: ")}{count}</output>
</div>
Styles object
Styles function
Additional information in body.
Semantic DOM
Object and callback with current props.
<script lang="ts">
import { ConfigProvider, Result } from '@woodger/antd';
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
</style>
<ConfigProvider result={{ styles: { root: 'padding: 20px' } }}>
<div class="examples">
<Result status="success" title={("Styles object")} subTitle={("Local slots")} headingLevel={4}
classNames={{ root: 'result-object' }} styles={{
root: `
border: 1px dashed #d48806;
border-radius: 8px;
`,
title: 'font-size: 20px'
}} />
<Result status="warning" title={("Styles function")} subTitle={("Styles receive status")} headingLevel={4}
classNames={{ root: 'result-function' }} styles={({ props }) => ({
subTitle: props.status === 'warning' ? 'font-weight: 700' : ''
})}>
<p>{("Additional information in body.")}</p>
</Result>
</div>
</ConfigProvider>
Tokens and RTL
Title, caption, icon font and action indentation.
<script lang="ts">
import { Button, ConfigProvider, Result } from '@woodger/antd';
</script>
{#snippet extra()}<Button
href={("/ant-design")}
>{("Go to review")}</Button>{/snippet}
<ConfigProvider direction="rtl" theme={{
components: {
Result: {
titleFontSize: 28, subtitleFontSize: 16, iconFontSize: 64, extraMargin: '32px 0 0'
}
}
}}>
<Result status="success" title={("Thematic result")} subTitle={("Isolated settings")} extra={(extra)} headingLevel={4} />
</ConfigProvider>
Operation completed
Submitting an application
Submitting an application
Edit, success, error, redo and focus control.
ResultExample.svelte<script lang="ts"> import { onDestroy, tick } from 'svelte'; import { Button, Checkbox, Form, FormItem, Input, Result, Select, createForm, type ResultStatus } from '@woodger/antd'; import { createResultSubmit, type ResultSubmission } from './result-submit.model.svelte'; const StatusSelect = Select<ResultStatus>; const model = createResultSubmit(); const form = createForm( { initialValues: { name: "Anna", email: 'anna@example.com' }, rules: ({ name: [{ required: true, message: "Enter name" }], email: [ { required: true, message: "Enter email" }, { pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, message: "Check email" } ] }) } ); const statuses: ResultStatus[] = ['success', 'error', 'info', 'warning', '403', '404', '500']; let status = $state<ResultStatus>('success'); let customIcon = $state(false); let actions = $state(true); let fail = $state(false); let actionCount = $state(0); let formHost = $state<HTMLDivElement>(); let resultHost = $state<HTMLDivElement>(); let active = true; let action = 0; onDestroy(() => { active = false; action++; model.destroy(); }); async function finish(values: ResultSubmission) { const outcome = await model.submit(values, fail); if (!active || outcome === 'cancelled' || outcome === 'busy') { return; } await tick(); if (active && model.status === outcome) resultHost?.focus({ preventScroll: true }); } async function edit(retry = false) { if (!model.edit()) { return; } const token = ++action; await tick(); if (!active || token !== action) { return; } if (retry) { const formElement = formHost?.querySelector('form'); formElement?.requestSubmit(); } else { const input = document.getElementById('result-example-name'); input?.focus({ preventScroll: true }); } } function reset() { action++; model.reset(); form.resetFields(); fail = false; } </script> <style> .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; } .field { width: 180px; } .preview, .workflow { margin-block: 24px; padding: 16px; border: 1px solid var(--ant-color-border-secondary); border-radius: var(--ant-border-radius-lg); } .form { max-width: 440px; margin: 24px auto; } .workflow:focus-visible { outline: 2px solid var(--ant-color-primary); outline-offset: 3px; } output { display: block; color: var(--ant-color-text-secondary); } </style> {#snippet previewIcon()}<svg width="72" height="72" viewBox="0 0 72 72" aria-hidden="true"><circle cx="36" cy="36" r="30" fill="var(--ant-color-primary-bg)" /><path d="m22 36 9 9 19-20" fill="none" stroke="var(--ant-color-primary)" stroke-width="5" /></svg>{/snippet} {#snippet previewActions()} <Button type="primary" onclick={() => { actionCount++; }}> {("Action Result")} </Button> {/snippet} {#snippet completionActions()}<Button type="primary" onclick={() => { void edit(); }}> {("Change request")} </Button>{#if model.status === 'error'}<Button onclick={() => { void edit(true); }} >{("Resend")}</Button>{/if}{/snippet} <div class="controls"><div class="field"><StatusSelect aria-label={("Status Result")} bind:value={status} options={(statuses.map(value => ({ value, label: String(value) })))} /></div><Checkbox bind:checked={customIcon} >{("Own icon Result")}</Checkbox><Checkbox bind:checked={actions} >{("Action in Result")}</Checkbox></div> <div class="preview"><Result {status} title={(status === 'success' ? "Operation completed" : status === 'error' ? "Failed to complete the operation" : status === 'info' ? "Operation information" : status === 'warning' ? "Check data" : String(status))} subTitle={("Select a status and try the action.")} icon={customIcon ? previewIcon : undefined} extra={(actions ? previewActions : undefined)} headingLevel={3} aria-label={("Preview Result")} /></div> <h3>{("Submitting an application")}</h3> <div class="controls" ><Checkbox bind:checked={fail} disabled={model.status === 'submitting'} >{("Error sending Result")}</Checkbox><Button onclick={reset} >{("Reset example Result")}</Button></div> {#if model.status === 'editing' || model.status === 'submitting'} <div class="workflow"><div class="form" bind:this={formHost}><Form {form} onFinish={finish} aria-label={("Application Result")} ><FormItem name="name" label={("Name on application")} htmlFor="result-example-name" help={("Participant name.")} ><Input value={form.values.name} onValueChange={value => form.setFieldValue('name', value ?? '')} /></FormItem><FormItem name="email" label={("Email in the application")} htmlFor="result-example-email" help={("name@example.com")} ><Input type="email" value={form.values.email} onValueChange={value => form.setFieldValue('email', value ?? '')} /></FormItem><Button type="primary" htmlType="submit" loading={form.isSubmitting} >{("Send request")}</Button></Form></div></div> {:else} <div class="workflow" bind:this={resultHost} role="region" aria-label={("Result of sending the application")} tabindex="-1" > <Result status={model.status} title={(model.status === 'success' ? "Application sent" : "Failed to submit application")} subTitle={("" + String((model.submitted?.name)) + ", " + String((model.submitted?.email)) + "")} extra={(completionActions)} headingLevel={4} > <p> {(model.status === 'success' ? "You can return to editing. The entered data is saved." : "Data saved. Clear the error box and resubmit or change the request.")} </p> </Result> </div> {/if} <output aria-label={("Example result Result")} >{("Condition: ")}{(model.status)}{(". Actions: ")}{actionCount}.</output>result-submit.model.svelte.tsexport interface ResultSubmission { name: string; email: string; } export type ResultOutcome = 'success' | 'error' | 'cancelled' | 'busy'; export function createResultSubmit() { let status = $state<'editing' | 'submitting' | 'success' | 'error'>('editing'); let submitted = $state.raw<Readonly<ResultSubmission>>(); let active = true; let generation = 0; let pending: { timer: ReturnType<typeof setTimeout>; resolve: (outcome: ResultOutcome) => void } | undefined; function cancel() { generation++; if (!pending) { return; } clearTimeout(pending.timer); pending.resolve('cancelled'); pending = undefined; } return { get status() { return status; }, get submitted() { return submitted; }, submit(values: ResultSubmission, fail = false): Promise<ResultOutcome> { if (!active) { return Promise.resolve('cancelled'); } if (pending) { return Promise.resolve('busy'); } const snapshot = { ...values }; const token = ++generation; status = 'submitting'; return new Promise(resolve => { const timer = setTimeout(() => { if (!active || generation !== token) { return; } pending = undefined; submitted = snapshot; status = fail ? 'error' : 'success'; resolve(status); }, 700); pending = { timer, resolve }; }); }, edit() { if (!active || pending) { return false; } status = 'editing'; return true; }, reset() { cancel(); status = 'editing'; submitted = undefined; }, destroy() { active = false; cancel(); } }; }
API
Nine ant.design 6.7.0 themes verified against the public Svelte API, including illustrations of exceptions.
| Theme | Example or limitation |
|---|---|
| Success | Completed operation and further action. |
| Info | Information about the accepted request. |
| Warning | Warning before continuing. |
| 403 | Illustration of lack of access. |
| 404 | Illustration of a missing page. |
| 500 | Illustration of a server error. |
| Error | Error details in body. |
| Custom icon | Snippet of the icon and icon=null. |
| Custom semantic dom styling | Object and function with props. |
Result
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local CSS prefix for Result and its nodes. The empty string and undefined inherit ConfigProvider.prefixCls; default ant-result. | string | ConfigProvider + -result |
status | Icon, illustration and result color; codes are accepted as a string and a number. | success | error | info | warning | 403 | 404 | 500 | info |
title | Result title. | ResultContent | — |
subTitle | Clarifying label. | ResultContent | — |
icon | Badge; null/false hide it for normal statuses. | ResultContent | by status |
extra | Buttons and links for further actions. | ResultContent | — |
children | Details in body. | ResultContent | — |
headingLevel | The level of the actual HTML header in the Svelte implementation. | 1 | 2 | 3 | 4 | 5 | 6 | 2 |
classNames | Semantic slots classes. | ResultSemanticSlots | callback | — |
styles | CSS lines slots. The function receives props with resolved status. | ResultSemanticSlots | callback | — |
nativeElement | bind:nativeElement gets the root after mount. | HTMLDivElement | — |
ref | bind:ref with the nativeElement field. | ResultRef | — |
ResultContent supports text, Snippet and array content. headingLevel controls the actual HTML header. ConfigProvider.result specifies classes, styles and semantic settings.
Semantic DOM
title uses headingLevel; extra preserves the native semantics of buttons and links. Aria-label/labelledby gives the root group, an explicit role can clarify it. Decorative SVGs do not repeat the result text.
| Slot | Purpose |
|---|---|
root | Result container. |
icon | Exception icon or illustration. |
title | Real heading headingLevel. |
subTitle | Explanatory caption. |
extra | Actions with native buttons and links. |
body | Result details. |
Registration tokens
Four tokens are set via ConfigProvider.theme.components.Result. iconFontSize refers to the regular icon; Illustrations of error codes have a separate geometry.
| Token | Purpose |
|---|---|
titleFontSize | Header size. |
subtitleFontSize | Label size. |
iconFontSize | Regular icon size. |
extraMargin | Action area indentation. |
| Token | Meaning |
|---|---|
colorError | #ff4d4f |
colorInfo | #1677ff |
colorSuccess | #52c41a |
colorWarning | #faad14 |
colorTextHeading | rgba(0,0,0,0.88) |
colorTextDescription | rgba(0,0,0,0.45) |
paddingLG | 24 |
FAQ
When is Result needed instead of Alert?
For the final status of an operation or page with details and further actions. Alert is suitable for local message.
Is it possible to replace the 404 illustration via icon?
No, the standard illustration takes precedence. For your icon, select Normal status.
What does Result receive?
Text, numbers, snippets and arrays. boolean/null do not output text; buttons are conveniently passed snippet to extra.
Does status:404 change the HTTP response?
No. This is the responsibility of the application route.
Who switches focus after sending?
Application. The example takes it to the result and saves the fields to return to editing.