Skeletons
Skeleton components can be used in a wide range of scenarios, such as when loading a page, an image, or a piece of text content. By using a Skeleton component, you can prevent abrupt changes in your application, providing a smoother visual transition as content loads.
One of the key features of the Skeleton component is its animation. By default, it uses a shimmer effect to better convey the loading state to the user. You can control whether this animation is active or not, and can also customize the speed of the animation. The Skeleton component in Chakra UI is highly flexible and can be adapted to fit a variety of shapes and sizes based on the content it's replacing. You can control its width, height, and other box model properties to fit your needs.
As far as accessibility, Chakra UI applies the appropriate ARIA roles and properties to the Skeleton component to indicate to assistive technologies that the content is being loaded. This makes it an excellent tool for building inclusive and performant user interfaces.
isLoaded
: Determines if the skeleton should still be shown or if the content is ready and should be displayed.startColor / endColor
: Controls the animation's color at the start and end. Typically you'll want to keep these subtle.fadeInDuration
: Determines the duration of the fade-in animation when the isLoaded prop becomes true.speed
: Controls the speed of the shimmer animation.To import these components:
Examples
Basic Usage::
The Invisible Wrapper::
Waiting on Remote Data:
Code
Skeleton Shapes and Text:
Code
Color-Changing Skeleton:
Code
Using isLoaded Prop:
Code
Controlling Fade Duration::
Code
Did you know?
Creative Idea No. 1
Code
Creative Idea No. 2
Name | |
---|---|
Code
Creative Idea No. 3
Code
copyright © 2023 IHeartComponents | evanmarie.com
created with love by the I♥️Components team using
Special thanks to Stefan Bohacek / Generative Placeholders.