--- localeCode: en-US order: 68 category: Feedback title: Skeleton subTitle: Skeleton icon: doc-skeleton brief: A placeholder preview of content before the data loaded. --- ## Overview - `Avatar`: Avatar placeholder, by default uses Avatar medium sizing: `width: 48px`, `height: 48px`. Supports other sizes after v1.0. - `Image`: Image placeholder, default size: `width: 100%`, `height: 100%`. - `Title`: Title placeholder, default size: `width: 100%`, `height: 24px`. - `Paragraph`: Content part placeholder, default size: `width: 100%`, `height: 16px`, `margin-bottom: 10px`. - `Button`: Button placeholder, default size: `width: 115px`, `height: 32px`. > Note: Default styles could by overwritten through `className` or `style`. ## Demos ### How to import ```jsx import { Skeleton } from '@douyinfe/semi-ui'; ``` ### Basic Usage ```jsx live=true import React from 'react'; import { Skeleton, Switch, Button, Avatar } from '@douyinfe/semi-ui'; class Demo extends React.Component { constructor() { super(); this.state = { loading: true }; } showContent() { const { loading } = this.state; this.setState({ loading: !loading, }); } render() { const { loading } = this.state; return ( <> this.showContent()} /> Show Loading Content
} loading={loading}> U
} loading={loading}> avatar
} loading={loading} >

Semi UI

} loading={loading}>

Carefully polish the user experience of each component.


} loading={loading}> ); } } ``` ### Combinations Image and caption. ```jsx live=true import React from 'react'; import { Skeleton } from '@douyinfe/semi-ui'; () => { const placeholder = (
); return ( avatar

Semi UI

); }; ``` Statistics. ```jsx live=true import React from 'react'; import { Skeleton, Descriptions } from '@douyinfe/semi-ui'; () => { const placeholder = (
); const data = [{ key: 'Actual User', value: '1,480,000' }]; return ( ); }; ``` Avatar and title. ```jsx live=true import React from 'react'; import { Skeleton, Avatar } from '@douyinfe/semi-ui'; () => { const placeholder = (
); return ( UI Semi UI ); }; ``` Centered paragraphs and button. ```jsx live=true import React from 'react'; import { Skeleton, Button } from '@douyinfe/semi-ui'; () => { const style = { display: 'flex', flexDirection: 'column', alignItems: 'center', width: '300px', marginBottom: '10px', }; const placeholder = (
); return (

Hi, Bytedance dance dance.

Hi, Bytedance dance dance.

); }; ``` Avatar, headline and paragraph. ```jsx live=true import React from 'react'; import { Skeleton, Avatar } from '@douyinfe/semi-ui'; () => { const style = { display: 'flex', alignItems: 'flex-start', }; const placeholder = (
); return (
UI

Semi UI

Hi, Bytedance dance dance.

Hi, Bytedance dance dance.

Hi, Bytedance dance dance.

); }; ``` Table. ```jsx live=true import React from 'react'; import { Skeleton, Table } from '@douyinfe/semi-ui'; () => { const data = { columns: [ { title: 'Name', dataIndex: 'name', }, { title: 'Age', dataIndex: 'age', }, { title: 'Address', dataIndex: 'address', }, ], content: [ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park, New York No. 1 Lake Park', }, { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', }, { key: '3', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park', }, { key: '4', name: 'Disabled User', age: 99, address: 'Sidney No. 1 Lake Park', }, ], }; const skData = { columns: [1, 2, 3].map(key => { const item = {}; item.title = ; item.dataIndex = key; return item; }), dataSource: [1, 2, 3, 4].map(key => { const item = {}; item.key = key; [1, 2, 3].forEach(i => { const width = 50 * i; item[i] = ; }); return item; }), }; const placeholder = (
); return (
); }; ``` ### Animated Loading Use `active` property to display animated loading effects. ```jsx live=true hideInDSM import React from 'react'; import { Skeleton, Avatar } from '@douyinfe/semi-ui'; () => { const style = { display: 'flex', alignItems: 'flex-start', }; const placeholder = (
); return (
UI

Semi UI

Hi, Bytedance dance dance.

Hi, Bytedance dance dance.

Hi, Bytedance dance dance.

); }; ``` ## API reference ### Skeleton | Property | Instructions | type | Default | | --- | --- | --- | --- | | active | Toggle whether to show the animated loading effect | boolean | false | | class Name | Class name | string | - | | loading | When set to true, the placeholder element is displayed. Otherwise, child element is displayed | boolean | true | | placeholder | Elements to be displayed while loading | ReactNode | - | | style | Inline style | CSSProperties | - | ### Skeleton.Avatar > `Skeleton.Image`,`Skeleton.Title`,`Skeleton.Button` have same APIs with `Skeleton.Avatar`. | Property | Instructions | type | Default | | --- | --- | --- | --- | | class Name | Class name | string | - | | size | Size of the avatar, one of `extra-extra-small`, `extra-small`, `small`, `medium`, `large`, `extra-large`, **v>=1.0** | string | `medium` | | style | Inline style | CSSProperties | - | ### Skeleton.Paragraph | Property | Instructions | type | Default | | --------- | --------------------------------------------------- | ------------- | ------- | | className | Class name | string | - | | rows | Set the number of rows in the placeholder paragraph | number | 4 | | style | Inline style | CSSProperties | - | ## Content Guidelines - Unchanged fixed content directly displays fixed content, and variable content is displayed using skeleton screen ## Design Tokens