Skeleton API
API reference docs for the React Skeleton component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import Skeleton from '@mui/joy/Skeleton';
// or
import { Skeleton } from '@mui/joy';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
animation | 'pulse' | 'wave' | false | 'pulse' | The animation. If |
children | node | - | Used to render icon or text elements inside the Skeleton if |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
height | Array<number | string> | number | { lg?: number | string, md?: number | string, sm?: number | string, xl?: number | string, xs?: number | string } | string | - | Height of the skeleton. Useful when you don't want to adapt the skeleton to a text element but for instance a card. |
level | 'h1' | 'h2' | 'h3' | 'h4' | 'title-lg' | 'title-md' | 'title-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'body-xs' | 'inherit' | string | variant === 'text' ? 'body-md' : 'inherit' | Applies the theme typography styles. |
loading | bool | true | If |
overlay | bool | false | If |
slotProps | { root?: func | object } | {} | The props used for each slot inside. |
slots | { root?: elementType } | {} | The components used for each slot inside. See Slots API below for more details. |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
variant | 'circular' | 'inline' | 'overlay' | 'rectangular' | 'text' | string | 'overlay' | The type of content that will be rendered. To learn how to add your own variants, check out Themed components—Extend variants. |
width | Array<number | string> | number | { lg?: number | string, md?: number | string, sm?: number | string, xl?: number | string, xs?: number | string } | string | - | Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own. |
ref
is forwarded to the root element.Theme default props
You can use JoySkeleton
to change the default props of this component with the theme.
To learn how to customize the slot, check out the Overriding component structure guide.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .MuiSkeleton-root | 'span' | The component that renders the root. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiSkeleton-body-lg | body-lg | Class name applied to the root element if level="body-lg" . |
.MuiSkeleton-body-md | body-md | Class name applied to the root element if level="body-md" . |
.MuiSkeleton-body-sm | body-sm | Class name applied to the root element if level="body-sm" . |
.MuiSkeleton-body-xs | body-xs | Class name applied to the root element if level="body-xs" . |
.MuiSkeleton-h1 | h1 | Class name applied to the root element if level="h1" . |
.MuiSkeleton-h2 | h2 | Class name applied to the root element if level="h2" . |
.MuiSkeleton-h3 | h3 | Class name applied to the root element if level="h3" . |
.MuiSkeleton-h4 | h4 | Class name applied to the root element if level="h4" . |
.MuiSkeleton-title-lg | title-lg | Class name applied to the root element if level="title-lg" . |
.MuiSkeleton-title-md | title-md | Class name applied to the root element if level="title-md" . |
.MuiSkeleton-title-sm | title-sm | Class name applied to the root element if level="title-sm" . |
.MuiSkeleton-variantCircular | variantCircular | Class name applied to the root element if variant="circular" . |
.MuiSkeleton-variantInline | variantInline | Class name applied to the root element if variant="inline" . |
.MuiSkeleton-variantOverlay | variantOverlay | Class name applied to the root element if variant="overlay" . |
.MuiSkeleton-variantRectangular | variantRectangular | Class name applied to the root element if variant="rectangular" . |
.MuiSkeleton-variantText | variantText | Class name applied to the root element if variant="text" . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.