Back to Ant Design

Spin

components/spin/index.en-US.md

6.3.72.5 KB
Original Source

When To Use

When part of the page is waiting for asynchronous data or during a rendering process, an appropriate loading animation can effectively alleviate users' inquietude.

Examples

<!-- prettier-ignore -->

<code src="./demo/basic.tsx">Basic Usage</code> <code src="./demo/size.tsx">Size</code> <code src="./demo/nested.tsx">Embedded mode</code> <code src="./demo/tip.tsx">Customized description</code> <code src="./demo/delayAndDebounce.tsx">Delay</code> <code src="./demo/custom-indicator.tsx">Custom spinning indicator</code> <code src="./demo/percent.tsx" version="5.18.0">Progress</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/fullscreen.tsx">Fullscreen</code>

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-
delaySpecifies a delay in milliseconds for loading state (prevent flush)number (milliseconds)-
descriptionCustomize description contentReactNode-6.3.0
fullscreenDisplay a backdrop with the Spin componentbooleanfalse5.11.0
indicatorReact node of the spinning indicatorReactNode-
percentThe progress percentage, when set to auto, it will be an indeterminate progressnumber | 'auto'-5.18.0
sizeThe size of Spin, options: small, medium and largestringmedium
spinningWhether Spin is visiblebooleantrue
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>-
tipCustomize description content when Spin has children. Deprecated, use description insteadReactNode-
wrapperClassNameThe className of wrapper when Spin has children. Deprecated, use classNames.root insteadstring-

Static Method

  • Spin.setDefaultIndicator(indicator: ReactNode)

    You can define default spin element globally.

Semantic DOM

<code src="./demo/_semantic.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component="Spin"></ComponentTokenTable>