Skeleton

관리자:
ogonkov
GitHub
import {Skeleton} from '@gravity-ui/uikit';

The Skeleton component displays a placeholder preview of your content before the data gets loaded. This preview is shown in order to reduce the loading time frustration.

Animation

Use the animation prop to control the loading animation. The default is 'gradient'.

ValueDescription
'gradient'Sliding gradient shimmer — default
'pulse'Opacity pulse
'none'No animation

Variant

Use the variant prop to choose a preset appearance. The default is 'rect'.

ValueDescription
'rect'Rounded corners using a size-aware border-radius token — default
'circle'Fully circular (border-radius: 50%, aspect-ratio: 1)
'square'Square aspect ratio (aspect-ratio: 1) with the same rounding as 'rect'
'text'Text line placeholder — height inherits font-size and line-height from parent context

Size

Use the size prop to set a preset skeleton height (and width for 'circle' / 'square' variants). Each size also adjusts the border-radius token used by 'rect' and 'square' variants. When size is omitted, set dimensions with width and height instead.

ValueDescription
'xs'Extra small
's'Small
'm'Medium
'l'Large
'xl'Extra large

Text placeholder

Use variant="text" to render a skeleton that inherits font-size and line-height from the parent context. Place multiple skeletons inside a <Text variant="..."> element for multiline placeholders.

Properties

NameDescriptionTypeDefault
styleCustom CSS properties for the root elementReact.CSSProperties
classNameCustom CSS class for the root elementstring
qadata-qa HTML attribute, used for testingstring
animationAnimation type to apply to the skeleton'gradient' | 'pulse' | 'none'gradient
variantPreset appearance. 'circle' and 'square' enforce aspect-ratio: 1. 'text' inherits typography from parent context.'rect' | 'square' | 'circle' | 'text'rect
sizePreset height (and width for 'circle'/'square' variants). Also controls the border-radius token for 'rect'/'square'.'xs' | 's' | 'm' | 'l' | 'xl'
widthCustom width. Alias for style.widthnumber | string
heightCustom height. Alias for style.heightnumber | string