1.0.8 • Published 11 months ago

@ice-house-web/simple-skeleton v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Lightweight and flexible React component library for creating skeleton loaders.

Installation

npm install @ice-house-web/simple-skeleton
# or
yarn add @ice-house-web/simple-skeleton

Usage

Basic Usage

import { Skeleton } from '@ice-house-web/simple-skeleton';

function MyComponent() {
  return (
    <div>
      <Skeleton width={200} height={20} />
      <Skeleton width="100%" height={40} />
    </div>
  );
}

Creating a Product Card

import { Skeleton } from '@ice-house-web/simple-skeleton';

function ProductCardSkeleton() {
  return (
    <div style={{ padding: '16px', borderRadius: '8px', border: '1px solid #eee' }}>
      {/* Product image */}
      <Skeleton width="100%" height={200} />

      {/* Product name */}
      <Skeleton width={150} height={24} style={{ marginTop: '12px' }} />

      {/* Description */}
      <Skeleton width="100%" height={16} style={{ marginTop: '8px' }} />
      <Skeleton width="80%" height={16} style={{ marginTop: '8px' }} />

      {/* Price */}
      <Skeleton width={80} height={24} style={{ marginTop: '16px' }} />
    </div>
  );
}

API

Skeleton

PropertyTypeDefaultDescription
classNamestring''Additional CSS class
widthstring | number'100%'Skeleton width
heightstring | number'100px'Skeleton height
borderstringundefinedBorder radius
circlebooleanfalseDisplay as circle
animation'pulse' | 'wave''wave'Animation type
animationSpeednumber2Animation speed in seconds
backgroundColorstring'#ffffff'Skeleton background color
highlightColorstring'#ececec'Wave animation highlight color
shadowColorstring'#e2eef1'Skeleton shadow color

Global Configuration

The library supports theming through CSS variables:

:root {
  --simple-skeleton-bg: #fff; /* Background color */
  --simple-skeleton-shadow: #e2eef1; /* Shadow color */
  --simple-skeleton-highlight: #ececec; /* Wave animation highlight color */
  --simple-skeleton-animation-speed: 2s; /* Animation speed */
}

License

MIT

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

0.0.1

11 months ago