Skeleton#
Download this notebook from GitHub (right-click to download).
import panel as pn
import panel_material_ui as pmui
pn.extension()
The Skeleton
component displays a placeholder preview of your content before the data gets loaded, reducing load-time frustration and improving perceived performance.
Skeleton screens provide an alternative to traditional spinner methods by creating anticipation of what is to come and reducing cognitive load. They are commonly used for:
Loading states in cards and lists
Content placeholders while data is fetching
Improving perceived performance
Creating better user experience during wait times
Parameters:#
For details on other options for customizing the component see the customization guides.
Core#
height
(int): Height of the skeleton component in pixels. If 0 or not specified, adapts to contentwidth
(int): Width of the skeleton component in pixels. If 0 or not specified, adapts to content
Display#
animation
(str): Animation variant - options include ‘pulse’ (default), ‘wave’, and None (disabled)color
(str): Background color - supports CSS color values and Material UI palette colorsvariant
(str): Shape variant - options include ‘text’ (default), ‘circular’, ‘rectangular’, ‘rounded’
Styling#
sx
(dict): Component level styling API for advanced customizationtheme_config
(dict): Theming API for consistent design system integration
Basic Usage#
Create a simple Skeleton
by providing a width
and height
:
skeleton = pmui.Skeleton(width=300, height=24)
skeleton
Animation#
By default the Skeleton will pulse but the animation
may also be set to wave or disabled by setting it to None
:
pmui.Column(
pmui.Skeleton(width=300, height=48, animation='pulse'),
pmui.Skeleton(width=300, height=48, animation='wave'),
pmui.Skeleton(width=300, height=48, animation=None),
)
Variants#
The Variant
component offers different shape variants:
text: Default style emulating a line of text
circular: Circular shape
rounded: Rounded corners
rectangular: Sharp corners for a more geometric look
pmui.Column(
pmui.Skeleton(width=300, height=24, variant='text', margin=(5, 0)),
pmui.Skeleton(width=48, height=48, variant='circular', margin=(5, 0)),
pmui.Skeleton(width=300, height=48, variant='rounded', margin=(5, 0)),
pmui.Skeleton(width=300, height=48, variant='rectangular', margin=(5, 0)),
)
Colors#
Skeleton
can be given arbitrary color specification, either based on Mui palettes or valid CSS colors
pmui.Column(
pmui.Skeleton(width=300, height=24, color='gray.900', margin=(5, 0)),
pmui.Skeleton(width=300, height=24, color='#639f31', margin=(5, 0)),
pmui.Skeleton(width=300, height=24, color='red', margin=(5, 0)),
)
Loading#
The Skeleton
component can be displayed in a loading state:
pmui.Row(
pmui.Skeleton(variant="rectangular", width=100, height=60, loading=True),
pmui.Skeleton(variant="circular", width=50, height=50, loading=True),
)
Api Reference#
pmui.Skeleton(variant="rectangular", width=200, height=40).api(jslink=True)
References#
Panel Documentation:
How-to guides on interactivity - Learn how to add interactivity to your applications using components
Setting up callbacks and links - Connect parameters between components and create reactive interfaces
Declarative UIs with Param - Build parameter-driven applications
Material UI Skeleton:
Material UI Skeleton Reference - Complete documentation for the underlying Material UI component
Material UI Skeleton API - Detailed API reference and configuration options
Download this notebook from GitHub (right-click to download).