Skip to main content

Skeleton Loading

The FlexNative Skeleton Loading is part of the FlexNative and is available under the @flexnative/skeleton-loading NPM package.

Dependencies

Installation

You can installing FlexNative Skeleton Loading packages using npm:

npm i @flexnative/skeleton-loading

API

import SkeletonLoader from '@flexnative/skeleton-loading';

Component

SkeletonLoader

Type: React.Component<IContentLoaderProps<T>>

Properties

info

IContentLoaderProps props extends SvgProps so any SvgProps propertie it is applicable also in IContentLoaderProps

NameTypeRequiredDefault ValueDescription
animatebooleanfalsetrueBoolean indicator whether to animate skeleton loading or not.
backgroundColorColorValuefalseundefinedBackground color.
foregroundColorColorValuefalseundefinedForeground color.
speednumberfalse1.2Animation speed.
intervalnumberfalse0.25Animation interval.
uniqueKeystringfalserandom stringUsed for unique key for <Rect fill='' clipPath='' />
beforeMaskJSX.Elementfalserandom stringCostum JSX.Element to render before loading mask.

Usecase Examples

The following example demonstrates the FlexNative Skeleton Loading in action.

warning

In documentation apprence of components may not be in correct way. To view the component in exact design please view the demo app.

Default

Colors

Animation Speed

Animation

Animation Interval

Mask

Mask Before

Playground

Live Editor
//Play with props to see live changes;

render(
  <SkeletonLoader width={'100%'} height={110} animate={true} backgroundColor='crimson' foregroundColor='#FFC436'>
    <Rect x="48" y="8" rx="3" ry="3" width="88" height="10" />
    <Rect x="48" y="26" rx="3" ry="3" width="52" height="6" />
    <Rect x="0" y="56" rx="3" ry="3" width="100%" height="6" />
    <Rect x="0" y="72" rx="3" ry="3" width="100%" height="6" />
    <Rect x="0" y="88" rx="3" ry="3" width="178" height="6" />
    <Circle cx="20" cy="20" r="20" />
  </SkeletonLoader>
);
Result
Loading...