New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-skeleton-image

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-skeleton-image

A skeleton image component which handles an image's loading and error states.

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

React Skeleton Image

A skeleton image component which handles an image's loading and error states.

This is a simple React image component which abstracts away all the dirty work you have to do to handle loading and error states of images.

Installation

npm i react-skeleton-image

or

yarn add react-skeleton-image

or

pnpm add react-skeleton-image

Usage

After installing the package, import Image component:

import { Image } from 'react-skeleton-image'

Import the CSS file (This step will not be needed in the next release):

import 'react-skeleton-image/dist/index.css'

You need to specify both width and height for the proper image sizing.

<Image
  src='https://rb.gy/fgpqyt'
  width={300}
  height={200}
/>

You can also specify the width and height in a container and wrap the Image component with it.

<div style={{ width: 300, height: 200 }}>
  <Image
    src='https://rb.gy/fgpqyt'
    width={300}
    height={200}
  />
</div>

It is recommended to set css properties like margin and padding in the container instead of the Image component.

<div style={{ width: 300, height: 200, margin: 30 }}>
  <Image
    src='https://rb.gy/fgpqyt'
    width={300}
    height={200}
  />
</div>

Props

NameTypeDescription
widthnumberThe width of the image in px.
heightnumberThe height of the image in px.
skeletonbooleanShow skeleton loading. Default: true
skeletonClassNamestringThe custom CSS class for skeleton loading.

Keywords

FAQs

Package last updated on 16 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc