Skip to Content

Skeleton

Indicate content loading state with placeholder animations.

Import

import { Skeleton } from '@tidbcloud/uikit'

Basic Usage

import { Skeleton } from '@tidbcloud/uikit' function Demo() { return ( <> <Skeleton height={50} circle mb="xl" /> <Skeleton height={8} radius="xl" /> <Skeleton height={8} mt={6} radius="xl" /> <Skeleton height={8} mt={6} width="70%" radius="xl" /> </> ) }

With Content

Wrap existing content and control loading overlay visibility with the visible prop:

import { useState } from 'react' import { Skeleton, Button } from '@tidbcloud/uikit' function Demo() { const [loading, setLoading] = useState(true) return ( <> <Skeleton visible={loading}>Lorem ipsum dolor sit amet...</Skeleton> <Button onClick={() => setLoading((l) => !l)}>Toggle Skeleton</Button> </> ) }

Key Props

PropTypeDescription
heightHeight<string | number>Skeleton height
widthCSSProperties[“width”]Skeleton width
radiusMantineRadius | numberBorder radius
circlebooleanIf set, width and border-radius equal to height
animatebooleanEnables animation
visiblebooleanControls overlay visibility when wrapping content
Last updated on