Basic example
Percentage width
Set percentage to treat width as a percent of the parent instead of pixels. width={70} with percentage renders at 70% of the container width.
Text
For text loading states, use TextFallback instead of setting height manually. It sizes to a typography font token's line height and accepts the same props as Fallback except height.
Shape
The shape of the fallback can further be customized with the shape prop.
Rectangular fallback width
If the fallback shape is a rectangle and the width is specified as a number, then by default, the width value will be recalculated and randomized within a predetermined threshold (e.g. to add some variety when multiple fallbacks are presented together). If this behavior is undesirable (e.g. in server-side rendered web apps), randomization can be disabled with the disableRandomRectWidth prop.
Alternatively, you may create a rectangle width variant by setting a number value on the rectWidthVariant prop. Variants map to a predetermined set of width values, which are cycled through repeatedly when the set is exhausted. Therefore, it's still possible to achieve some variety, but in a deterministic manner (i.e. safe for server-side rendering).
Accessibility
Fallback has an accessibilityLabel prop to describe the loading state for assistive technologies. Wrap Fallback in a live region container to announce loading state changes.
If you render multiple Fallbacks in an area, you may use aria-hidden prop on each Fallback to disable individual announcements from assistive technologies. If you choose to do so, please add your own label in the parent container to indicate the loading state for the entire area. While the label element can be visually hidden, it is still crucial to mark the container as a live region for the label to be announced when state changes.