How to use SkeletonBodyText
Use the SkeletonBodyText
component to simulate bodies of text with multiple lines whenever loading asynchronous data.
Import
import { SkeletonBodyText } from '@contentful/f36-components';// orimport { SkeletonBodyText } from '@contentful/f36-skeleton';
Code examples
Best practices
- Each
SkeletonBodyText
needs to be wrapped by a SkeletonContainer component - Use the
numberOfLines
prop to determine how many lines you want to render. We advise using a value that matches the number of lines the text will have after loading.
Props
- Name
lineHeight
DescriptionA height of a one line (in pixels)
Defaultstringnumber16 - Name
marginBottom
DescriptionSpacing between lines (in pixels)
Defaultstringnumber8 - Name
numberOfLines
DescriptionA number of skeleton likes
Defaultnumber2 - Name
offsetLeft
DescriptionA distance between left of the container and the beginning of lines (in pixels)
Defaultstringnumber0 - Name
offsetTop
DescriptionA distance between top of the container and the first line (in pixels)
Defaultstringnumber0 - Name
width
DescriptionA width of a line
stringnumber