JGuang

Result

Result · Ant Design

Preview
npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Result

Used to feedback the processing results of a series of operations.

When To Use

Use when important operations need to inform the user to process the results and the feedback is more complicated.

Examples

  • Success · success
  • Info · info
  • Warning · warning
  • 403 · 403
  • 404 · 404
  • 500 · 500
  • Error · error
  • Custom icon · customIcon
  • Custom semantic dom styling · style-class

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or functionRecord<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-6.0.06.0.0
extraOperating areaReactNode-×
iconCustom back iconReactNode-×
statusResult status, decide icons and colorssuccess | error | info | warning | 404 | 403 | 500info×
stylesCustomize inline style for each semantic structure inside the component. Supports object or functionRecord<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-6.0.06.0.0
subTitleThe subTitleReactNode-×
titleThe titleReactNode-×

Semantic DOM

Semantic nodeNative descriptionVersion
rootRoot element with text alignment, layout styles and other basic container styles6.0.0
iconIcon element with margin, text alignment, font size, status colors and other icon styles6.0.0
titleTitle element with font size, text color, line height, text alignment and other text styles6.0.0
subTitleSubtitle element with font size, text color, line height and other text styles6.0.0
extraAction area element with margin, text alignment, inner element spacing and other layout styles6.0.0
bodyContent element with margin, padding, background color and other content area styles6.0.0

Semantic description source: vendor/components/result/demo/_semantic.tsx

Design Token

Types, inheritance and declarations retain the pinned native source. Defaults are computed by the native theme and may be overridden by ConfigProvider; this table does not invent static defaults.

TokenTypeNative description
titleFontSizenumber | stringTitle font size
subtitleFontSizenumberSubtitle font size
iconFontSizenumber | stringIcon size
extraMarginCSSProperties['margin']Margin of extra area

Declaration source: vendor/components/result/style/index.ts

import type { CSSProperties } from 'react';

import type { CSSObject } from '@ant-design/cssinjs';

import { unit } from '@ant-design/cssinjs';

import { isNumber } from '../../_util/is';

import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

import { genStyleHooks, mergeToken } from '../../theme/internal';

export interface ComponentToken {
  /**
   * @desc 标题字体大小
   * @descEN Title font size
   */
  titleFontSize: number | string;
  /**
   * @desc 副标题字体大小
   * @descEN Subtitle font size
   */
  subtitleFontSize: number;
  /**
   * @desc 图标大小
   * @descEN Icon size
   */
  iconFontSize: number | string;
  /**
   * @desc 额外区域外间距
   * @descEN Margin of extra area
   */
  extraMargin: CSSProperties['margin'];
}

interface ResultToken extends FullToken<'Result'> {
  imageWidth: number | string;
  imageHeight: number | string;
  resultInfoIconColor: string;
  resultSuccessIconColor: string;
  resultWarningIconColor: string;
  resultErrorIconColor: string;
}

Shared native props

Tips: The following generic properties apply to most antd components; those not supported are described separately.

PropertyDescriptionTypeDefault
styleThe additional styleCSSProperties-
classNameThe additional css classstring-
rootClassNameClassName on the root elementstring-
autoFocusAuto focus when component mounted, only effective for focusable elements like forms, links, etc.booleanfalse

Install and reproduce an example

npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Use ConfigProvider and native App; configure dayjs locale separately. Each example lists its complete source files and additional pinned dependencies in View code. Example names select demos, not universal component props. See the resource setup guide for theme, locale and SSR.

Native type references

The source viewer includes unchanged native implementations and the following source declarations. Inherited types remain in their native packages. English source comments are preserved as code reference.

  • vendor/components/result/index.tsx
  • vendor/components/result/style/index.ts

Source and license

https://github.com/ant-design/ant-design/tree/4a39f54842eade4e565ab336ef6097cd7e723cdd

Original bilingual prose and executable examples are retained. Website-only embeds and token tables are expanded locally. Ant Design is MIT; separately listed dependency notices also apply. Upload previews block outbound requests and do not provide a backend.