MDK Logo
UI Kitreact-devkitComponentsCoreFeedback

SkeletonBlock

Rectangular shimmer placeholder used to hint at content shape while data is loading.

Rectangular shimmer placeholder used to hint at content shape while data is loading.

import { SkeletonBlock } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
circleOptionalboolean
classNameOptionalstring
widthOptionalstring | number
heightOptionalstring | number
borderRadiusOptionalstring | number

Usage

A pulsing placeholder used to indicate loading content. Supports rectangular and circular shapes.

Exports

NameDescription
SkeletonBlockA single skeleton element with configurable dimensions and border radius

SkeletonBlock Props

All props are optional.

PropTypeDefaultDescription
widthnumber | stringWidth in pixels (number) or any CSS value (string)
heightnumber | stringHeight in pixels (number) or any CSS value (string)
borderRadiusnumber | stringBorder radius; ignored when circle is true
circlebooleanfalseRenders a perfect circle using height as the diameter
classNamestringAdditional class for the element

All other div HTML attributes are forwarded.

Notes

  • Passing a number to width, height, or borderRadius automatically appends 'px'.

Example

/** * Runnable example for SkeletonBlock. */import { SkeletonBlock } from '@tetherto/mdk-react-devkit'export const SkeletonExample = () => (  <div className="mdk-example-col">    {/* Text lines */}    <SkeletonBlock width={320} height={16} borderRadius={4} />    <SkeletonBlock width={240} height={16} borderRadius={4} />    <SkeletonBlock width={280} height={16} borderRadius={4} />    {/* Avatar + text row */}    <div className="mdk-example-inline">      <SkeletonBlock circle height={40} />      <div className="mdk-example-col">        <SkeletonBlock width={160} height={14} borderRadius={4} />        <SkeletonBlock width={120} height={12} borderRadius={4} />      </div>    </div>    {/* Card placeholder */}    <SkeletonBlock width="100%" height={80} borderRadius={8} />  </div>)