Skeleton Loader
SkeletonLoader is used to render loading Skeleton.
Example
<SkeletonLoader type="multi-line" width="50%" />
Variant
The SkeletonLoader component is in 4 different types: text, rect, circle, multi-line that is accessed with type prop.
Circle
The type circle is a loading that can be used as a circular loader.
Circle loader also take 2 props width and height to create the circle.
<SkeletonLoader type="circle" width={100} height={100} />
Multi Line
The type multiLine is a loading that can be used as a Multi-Line loader.
multi-Line type supports all sizes as text type: 1, 2, 3, 4 which can be accessed using textSize prop.
Number of lines in Multi-Line loader can be managed using multiLines prop.
Addition to this we can manage the width of the loader.
<div style={{ width: '50%' }}> <SkeletonLoader type="multi-line" textSize={1} multiLines={5} /> <br /> <br /> <SkeletonLoader type="multi-line" textSize={2} multiLines={4} /> </div>
Rect
The type rect is a loading that can be used as a rectangle loader.
Rect loader have 2 props width and height to create the rectangle.
<SkeletonLoader type="rect" width={100} height={100} />
Text
The type text is a loading that can be used as a text loader.
Text loader have 4 different sizes: 1,2,3,4 which can be accessed using textSize prop.
<div style={{ width: '50%' }}> <SkeletonLoader type="text" textSize={1} /> <SkeletonLoader type="text" textSize={2} /> <SkeletonLoader type="text" textSize={3} /> <SkeletonLoader type="text" textSize={4} /> </div>
The line-height of the can be managed using the lineHeight prop in pixels as number.
<div style={{ width: '50%' }}> <SkeletonLoader type="text" textSize={1} lineHeight={64} /> <SkeletonLoader type="text" textSize={2} /> <SkeletonLoader type="text" textSize={3} /> </div>
we can generate random width for the text type using the random boolean prop.
<div style={{ width: '50%' }}> <SkeletonLoader type="text" textSize={1} random /> <SkeletonLoader type="text" textSize={2} /> <SkeletonLoader type="text" textSize={3} /> </div>
Props
| Name | Type | Default |
|---|---|---|
type It is the type of skeleton |
| "text" |
width Frame width as number or a percentage string |
| — |
height Frame height as number or a percentage string |
| — |
textSize Size of the TextLoader |
| 1 |
multiLines No. of Multilines |
| 3 |
lineHeight Line Height of the loader |
| — |
random Generetes random width of text loader is a boolean |
| false |
align Alignment of the loader when width not 100% |
| "left" |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
| * - the prop is required. |