Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-lazy-card

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lazy-card

A lighweight image lazy-loading component written in React

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
79
increased by36.21%
Maintainers
1
Weekly downloads
 
Created
Source

#react-lazy-card

A lighweight image lazy-loading component written in React

codecov Build Status npm GitHub license

It supports both manual and automatic image lazy-loading.

Demo is available here.

Installation

npm install --save react-lazy-card

Basic Usage

JSX:

import LazyCard from 'react-lazy-card';

<LazyCard image="b.jpg" autoLoad={true} defaultimage="default2.jpg">Text 2</LazyCard>

CSS

@import "react-lazy-card/dist/slide"

Options

propdefaultdescription
classNamestringcustom classname for lazy-card component
imagestringfinal image to be loaded
defaultImagestringpre-loader image to be shown
autoLoadfalseshould the component automatically lazyLoad the image
attributes{}Additional attributes for component root
title''serves like alt attribute for img tag
lazyLoadtrueenable/disable lazy load
.load()

If autoload is set to false the you have to manually call .load() to load the image

// This will not load `image` automatically. Will load default1.jpg
const a = <LazyCard image="a.jpg" defaultImage="default1.jpg">Text 1</LazyCard>
a.load() // now image will be loaded

// Alternatively set `autoLoad` to true. So `a.jpg` will automatically replace
// default1.jpg when it is loaded.
<LazyCard image="a.jpg" defaultImage="default1.jpg" autoLoad={true}>Text 1</LazyCard>

Development

git clone https://github.com/housinghq/react-lazy-card
cd react-lazy-card
npm install
npm run storybook

Open an issue before opening a PR. This package is optimised for mobile so its hard to include all the features.

###License MIT @ Loconsolutions

Keywords

FAQs

Package last updated on 13 Oct 2016

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