Command palette

@yasinsensoy/native

React Native · Components

Skeleton

A faded box that holds the place of content while it loads.

4 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

Code

import { Skeleton } from "@yasinsensoy/native";

<div aria-busy="true" className="flex items-center gap-3">
  <Skeleton shape="circle" width={48} />
  <Skeleton lines={2} className="flex-1" />
</div>

Events

  1. Events appear here when you interact with the preview.

Import

import { Skeleton } from "@yasinsensoy/native";

Skeleton

component

A faded box that holds the place of content while it loads. The animation runs on the native driver; it stops with the "reduce motion" preference. Hidden from screen readers.

Skeleton({ shape: shapeProp, lines, width, height, animation, loading, children, style, }: SkeletonProps): JSX.Element

Examples

<Skeleton shape="circle" width={40} />
<Skeleton lines={3} />
<Skeleton loading={!product}><ProductCard product={product ?? sample} /></Skeleton>

Skeleton shape: rect box, circle round (avatar), text text line.

type SkeletonShape = "rect" | "circle" | "text"

Animation: pulse fading, shimmer sliding sheen, none static.

type SkeletonAnimation = "pulse" | "shimmer" | "none"

SkeletonProps

interface

Skeleton props.

NameTypeDefaultDescription
shape?SkeletonShape"rect"`, `"text"` when `lines` is givenShape.
lines?numberParagraph: this many lines are drawn, the last line stays short.
width?DimensionValueWidth (pixels or percent). The diameter for circle.
height?DimensionValuetext` 12, `rect` 16, `circle` the widthHeight.
animation?SkeletonAnimation"pulse"Animation.
loading?booleantrueAutomatic skeleton: when children is given and this is true, the content is hidden and a faded box of the same size is shown; when false the content appears.
children?ReactNodeContent whose place is held in the automatic skeleton.
style?StyleProp<ViewStyle>Container style.