logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.4.5
  • Components Overview
  • Changelog
    v6.4.5
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic Usage
Size
Embedded mode
Customized description
Delay
Custom spinning indicator
Progress
Custom semantic dom styling
Fullscreen
API
Static Method
Semantic DOM
Design Token

Spin

Used for the loading status of a page or a block.
Importimport { Spin } from 'antd';
GitHub
components/spinIssueOpen issues
Docs
Edit this pageLLMs.md
SkeletonWatermark

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

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

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>-6.0.0
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-5.20.0
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>-6.0.0
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

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
contentHeightHeight of content areastring | number400
dotSizeLoading icon sizenumber20
dotSizeLGLarge loading icon sizenumber32
dotSizeSMSmall loading icon sizenumber14
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorBgContainerContainer background color, e.g: default button, input box, etc. Be sure not to confuse this with `colorBgElevated`.string#ffffff
colorBgMaskThe background color of the mask, used to cover the content below the mask, Modal, Drawer, Image and other components use this tokenstringrgba(0,0,0,0.45)
colorFillSecondaryThe second level of fill color can outline the shape of the element more clearly, such as Rate, Skeleton, etc. It can also be used as the Hover state of the third level of fill color, such as Table, etc.stringrgba(0,0,0,0.06)
colorPrimaryBrand color is one of the most direct visual elements to reflect the characteristics and communication of the product. After you have selected the brand color, we will automatically generate a complete color palette and assign it effective design semantics.string#1677ff
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorTextDescriptionControl the font color of text description.stringrgba(0,0,0,0.45)
colorTextLightSolidControl the highlight color of text with background color, such as the text in Primary Button components.string#fff
colorWhitePure white color don't changed by themestring#fff
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
lineHeightLine height of text.number1.5714285714285714
marginXXSControl the margin of an element, with the smallest size.number4
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
paddingSMControl the small padding of the element.number12
zIndexPopupBaseBase zIndex of component like FloatButton, Affix which can be cover by large popupnumber1000
Basic Usage

A simple loading status.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Embedded mode

Embedding content into Spin will set it into loading state.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Delay

Specifies a delay for loading state. If spinning ends during delay, loading status won't appear.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Progress

Show the progress. When percent="auto" is set, an indeterminate progress will be displayed.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.18.0
Fullscreen

The fullscreen mode is perfect for creating page loaders. It adds a dimmed overlay with a centered spinner.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Size

A small Spin is used for loading text, default sized Spin for loading a card-level block, and large Spin used for loading a page.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Customized description

Customize the description text.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom spinning indicator

Use custom loading indicator.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

You can customize the semantic dom style of Spin by passing objects/functions through classNames and styles.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
Alert message title
Further details about the context of this alert.

Loading state:

Alert message title
Further details about the context of this alert.

Loading state:

Loading
Loading
Loading
Loading...
Alert message title
Further details about the context of this alert.
Loading
Loading
  • root
    6.0.0
    The root element, which sets absolute positioning, display control, color, font size, text alignment, vertical alignment, opacity, and transition animation (only effective when fullscreen is false)
  • section
    6.3.0
    The loading element area, which sets relative positioning, flexbox layout, alignment, and color
  • indicator
    6.0.0
    The indicator element, which sets width, height, font size, inline-block display, transition animation, transform origin, and line height
  • description
    6.3.0
    The description element, which sets font size and line height
  • container
    6.3.0
    The container element that holds the child elements wrapped by Spin, setting opacity and transition animation