JGuang

Skeleton

Skeleton · Material UI

Preview
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Skeleton

Reserve the expected shape of content while the host is loading it.

This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.

Use case and business boundary

Skeleton does not load data; switch to actual content and expose meaningful loading status separately.

Native composition and scope

Skeleton

Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.

Native installation and initialization

npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.

Practical native parameters

These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.

Owner.propPractical roleDeclaration source
Skeleton.variantOwning native presentation enum; never substitute a universal variant prop.Skeleton
Skeleton.animationNative Skeleton animation enum; false disables animation.Skeleton
Skeleton.widthNative explicit Skeleton width; preserve CSS-length typing.Skeleton
Skeleton.heightNative explicit Skeleton height; preserve CSS-length typing.Skeleton

Runnable native examples

Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.

  • Variants · Variants · upstream native demo
  • Animations · Animations · upstream native demo
  • Pulsate example · YouTube · upstream native demo
  • Wave example · Facebook · upstream native demo
  • Inferring dimensions · SkeletonTypography · upstream native demo
  • Inferring dimensions · SkeletonChildren · upstream native demo
  • Color · SkeletonColor · upstream native demo

Actual usage example

Unmodified pinned native demo; copy its required local helper files together.

import Skeleton from '@mui/material/Skeleton';
import Stack from '@mui/material/Stack';

export default function Variants() {
  return (
    <Stack spacing={1}>
      {/* For variant="text", adjust the height via font-size */}
      <Skeleton variant="text" sx={{ fontSize: '1rem' }} />

      {/* For other variants, adjust the size with `width` and `height` */}
      <Skeleton variant="circular" width={40} height={40} />
      <Skeleton variant="rectangular" width={210} height={60} />
      <Skeleton variant="rounded" width={210} height={60} />
    </Stack>
  );
}

Example dependency boundaries

@mui/material/Skeleton, @mui/material/Stack, @mui/material/Box, @mui/material/Grid, @mui/material/Typography, react, @mui/material/Card, @mui/material/CardHeader, @mui/material/CardContent, @mui/material/CardMedia, @mui/material/Avatar, @mui/material/IconButton, @mui/icons-material/MoreVert, @mui/material/styles

Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.

Pinned upstream API metadata reference

These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.

Skeleton

import Skeleton from '@mui/material/Skeleton';
import { Skeleton } from '@mui/material';
PropRequiredUpstream metadata type / constraintMetadata default
animationno'pulse' | 'wave' | false'pulse'
childrennonode—
classesnoobject—
componentnoelementType—
heightnonumber | string—
sxnoArray<func | object | bool> | func | object—
variantno'circular' | 'rectangular' | 'rounded' | 'text' | string'text'
widthnonumber | string—

Native source declarations

Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.

vendor/src/Skeleton/Skeleton.d.ts

import * as React from 'react';

import { SxProps } from '@mui/system';

import { OverridableStringUnion } from '@mui/types';

import { Theme } from '../styles';

import { OverridableComponent, OverrideProps } from '../OverridableComponent';

import { SkeletonClasses } from './skeletonClasses';

export interface SkeletonPropsVariantOverrides {}

export interface SkeletonOwnProps {
  /**
   * The animation.
   * If `false` the animation effect is disabled.
   * @default 'pulse'
   */
  animation?: 'pulse' | 'wave' | false | undefined;
  /**
   * Optional children to infer width and height from.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<SkeletonClasses> | undefined;
  /**
   * Height of the skeleton.
   * Useful when you don't want to adapt the skeleton to a text element but for instance a card.
   */
  height?: number | string | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
  /**
   * The type of content that will be rendered.
   * @default 'text'
   */
  variant?:
    | OverridableStringUnion<
        'text' | 'rectangular' | 'rounded' | 'circular',
        SkeletonPropsVariantOverrides
      >
    | undefined;
  /**
   * Width of the skeleton.
   * Useful when the skeleton is inside an inline element with no width of its own.
   */
  width?: number | string | undefined;
}

export interface SkeletonTypeMap<
  AdditionalProps = {},
  RootComponent extends React.ElementType = 'span',
> {
  props: AdditionalProps & SkeletonOwnProps;
  defaultComponent: RootComponent;
}

declare const Skeleton: OverridableComponent<SkeletonTypeMap>;

export type SkeletonProps<
  RootComponent extends React.ElementType = SkeletonTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<SkeletonTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};

Post-install acceptance

Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.

Source and license

https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e

MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.