Back to Ant Design

Skeleton

components/skeleton/index.en-US.md

6.3.73.4 KB
Original Source

When To Use

  • When a resource needs long time to load.
  • When the component contains lots of information, such as List or Card.
  • Only works when loading data for the first time.
  • Could be replaced by Spin in any situation, but can provide a better user experience.

Examples

<!-- prettier-ignore -->

<code src="./demo/basic.tsx">Basic</code> <code src="./demo/complex.tsx">Complex combination</code> <code src="./demo/active.tsx">Active Animation</code> <code src="./demo/element.tsx">Button/Avatar/Input/Image/Node</code> <code src="./demo/children.tsx">Contains sub component</code> <code src="./demo/list.tsx">List</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/componentToken.tsx" debug>Custom component token</code>

API

Common props ref:Common props

Common API

<embed src="./shared/sharedProps.en-US.md"></embed>

Skeleton

PropertyDescriptionTypeDefaultVersion
activeShow animation effectbooleanfalse
avatarShow avatar placeholderboolean | SkeletonAvatarPropsfalse
loadingDisplay the skeleton when trueboolean-
paragraphShow paragraph placeholderboolean | SkeletonParagraphPropstrue
roundShow paragraph and title radius when truebooleanfalse
titleShow title placeholderboolean | SkeletonTitlePropstrue

SkeletonTitleProps

PropertyDescriptionTypeDefault
widthSet the width of titlenumber | string-

SkeletonParagraphProps

PropertyDescriptionTypeDefault
rowsSet the row count of paragraphnumber-
widthSet the width of paragraph. When width is an Array, it can set the width of each row. Otherwise only set the last row widthnumber | string | Array<number | string>-

Skeleton.Avatar

PropertyDescriptionTypeDefault
activeShow animation effect, only valid when used avatar independentlybooleanfalse
shapeSet the shape of avatarcircle | squarecircle
sizeSet the size of avatarnumber | large | medium | smallmedium

Skeleton.Button

PropertyDescriptionTypeDefaultVersion
activeShow animation effectbooleanfalse
blockOption to fit button width to its parent widthbooleanfalse4.17.0
shapeSet the shape of buttoncircle | round | square | default-
sizeSet the size of buttonlarge | medium | smallmedium

Skeleton.Input

PropertyDescriptionTypeDefault
activeShow animation effectbooleanfalse
sizeSet the size of inputlarge | medium | smallmedium

Semantic DOM

Skeleton

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

Skeleton.Element

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

Design Token

<ComponentTokenTable component="Skeleton"></ComponentTokenTable>