--- title: Skeleton description: "`Skeleton` is a component that acts as a placeholder until content is loaded." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/skeleton/skeleton.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/skeleton - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-skeleton--basic --- # Skeleton `Skeleton` is a component that acts as a placeholder until content is loaded. ```tsx ``` ## Usage ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@yamada-ui/react" ``` ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@/components/ui" ``` ```tsx import { Skeleton, SkeletonCircle, SkeletonText } from "@workspaces/ui" ``` ```tsx ``` ### Change Variant ```tsx {(variant) => ( )} ``` ### Change Size ```tsx ``` Additionally, by passing child elements, you can match the width and height. ```tsx Badge Badge ``` ### Change Blink Color To change the blink color, use the `startColor` and `endColor` properties. ```tsx ``` ### Change Text Gap To change the gap between text lines, set the `gap` property. ```tsx ``` ### Specify Number of Lines To specify the number of lines, set a numeric value to `lineClamp`. ```tsx ``` ### Change Blink Duration To change the blink duration, set a numeric value (seconds) to `duration`. ```tsx ``` ### Display Child Elements To display child elements, pass `false` to `loading`. ```tsx const { loading } = useAsync(() => wait(3000)) return ( プリン つぶらな 瞳が 揺れるとき 眠たくなるような 不思議で 気持ちの良い 歌を 歌う。 ) ``` ### Change Fade In Duration To change the fade in duration, set a numeric value (seconds) to `fadeDuration`. ```tsx const { loading } = useAsync(() => wait(3000)) return ( プリン つぶらな 瞳が 揺れるとき 眠たくなるような 不思議で 気持ちの良い 歌を 歌う。 ) ``` ## Props ### Skeleton | Prop | Default | Type | Description | | -------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | `"pulse"` | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `number \| string` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `number \| string` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ### SkeletonCircle | Prop | Default | Type | Description | | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | - | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `number \| string` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `number \| string` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ### SkeletonText | Prop | Default | Type | Description | | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | - | `"none" \| "pulse" \| "shine"` | The variant of the component. | | `duration` | - | `string \| number` | The animation duration in seconds. | | `endColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation end. | | `fadeDuration` | - | `string \| number` | The fade in duration in seconds. Requires `loaded` toggled to `true` in order to see the transition. | | `fitContent` | `false` | `boolean` | If `true`, the skeleton will take the width of it's children. | | `lineClamp` | - | `number` | The number of lines to display. | | `rootProps` | - | `HTMLStyledProps` | Props for the root element. | | `startColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The color at the animation start. | ## Similar Components - [Airy](https://yamada-ui.com/docs/components/airy.md): `Airy` is a component that provides a smooth animation to switch between two elements. - [EmptyState](https://yamada-ui.com/docs/components/empty-state.md): `EmptyState` is a component used to display when a resource is empty or unavailable. - [Flip](https://yamada-ui.com/docs/components/flip.md): `Flip` is a component that provides an animation to switch between two elements while flipping. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Motion](https://yamada-ui.com/docs/components/motion.md): `Motion` is a convenient component that extends the Yamada UI Style Props to `Motion`. - [Ripple](https://yamada-ui.com/docs/components/ripple.md): `Ripple` is a component that adds a ripple effect to elements, allowing users to recognize when they have clicked. - [Rotate](https://yamada-ui.com/docs/components/rotate.md): `Rotate` is a component that provides an animation to switch between two elements while rotating. - [Alert](https://yamada-ui.com/docs/components/alert.md): `Alert` is a component that conveys information to the user.