Ant Design Svelte

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

Project published

Components and documentation are available to visitors.

Success

Completed publication and transition to review.

Request accepted

The result will appear after processing.

Information

The request has been accepted for processing.

Need additional verification

Please check your settings before publishing.

Warning

Additional verification required.

403

You do not have access to this section.

403 - no access

Standard illustration of exception.

404

The requested page was not found.

404 - page not found

Standard missing page illustration.

500

Failed to process the request. Please try again later.

500 - server error

Standard failure illustration.

Application not accepted

Correct the data and resend.

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.

Check completed

Text only

Confirmed: 0

Own icon and action

Snippet, hidden icon and button handler.

Styles object

Local slots

Styles function

Styles receive status

Additional information in body.

Semantic DOM

Object and callback with current props.

Thematic result

Isolated settings

Tokens and RTL

Title, caption, icon font and action indentation.

Operation completed

Select a status and try the action.

Submitting an application

Participant name.
name@example.com
Condition: editing. Actions: 0.

Submitting an application

Edit, success, error, redo and focus control.

API

Nine ant.design 6.7.0 themes verified against the public Svelte API, including illustrations of exceptions.

Example themes
ThemeExample or limitation
SuccessCompleted operation and further action.
InfoInformation about the accepted request.
WarningWarning before continuing.
403Illustration of lack of access.
404Illustration of a missing page.
500Illustration of a server error.
ErrorError details in body.
Custom iconSnippet of the icon and icon=null.
Custom semantic dom stylingObject and function with props.

Result

PropertyDescriptionTypeDefault
prefixClsFull local CSS prefix for Result and its nodes. The empty string and undefined inherit ConfigProvider.prefixCls; default ant-result.stringConfigProvider + -result
statusIcon, illustration and result color; codes are accepted as a string and a number.success | error | info | warning | 403 | 404 | 500info
titleResult title.ResultContent—
subTitleClarifying label.ResultContent—
iconBadge; null/false hide it for normal statuses.ResultContentby status
extraButtons and links for further actions.ResultContent—
childrenDetails in body.ResultContent—
headingLevelThe level of the actual HTML header in the Svelte implementation.1 | 2 | 3 | 4 | 5 | 62
classNamesSemantic slots classes.ResultSemanticSlots | callback—
stylesCSS lines slots. The function receives props with resolved status.ResultSemanticSlots | callback—
nativeElementbind:nativeElement gets the root after mount.HTMLDivElement—
refbind: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.

Result
SlotPurpose
rootResult container.
iconException icon or illustration.
titleReal heading headingLevel.
subTitleExplanatory caption.
extraActions with native buttons and links.
bodyResult 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.

TokenPurpose
titleFontSizeHeader size.
subtitleFontSizeLabel size.
iconFontSizeRegular icon size.
extraMarginAction area indentation.
Common tokens of the current topic
TokenMeaning
colorError#ff4d4f
colorInfo#1677ff
colorSuccess#52c41a
colorWarning#faad14
colorTextHeadingrgba(0,0,0,0.88)
colorTextDescriptionrgba(0,0,0,0.45)
paddingLG24

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.