Socket
Socket
Sign inDemoInstall

react-picture

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-picture

Responsive images component for React.JS


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

react-picture

Build Status

React component for rendering responsive images. Attempts to implement <img srcset=...> support in non-compliant browsers, otherwize renders the native <img srcset>. Will eventually support Picture & Source elements.

How to use

npm install react-picture

Then use in your react app like so:

var Img = require('react-picture').Image;
...
   render: function() {
   	  var imgs = '//placebacon.net/200/150 600w, //placebacon.net/300/300 800w';

      return (
      	<Img alt='Your picture description' srcSet={imgs} extra={{className='myImg'}}/>
      );
   }
...

The following properties can be passed to the Image component:

  • alt - Required and describes your picture
  • srcSet - Required and consists of a string formated like srcset
  • extra - Optional object which contains properties that will be put on img tag

Features

  • Use <img srcset> when supported
  • Implement srcset support for browsers that do not have it, using javascript. Currently missing sizes implementation.

Roadmap

0.1.0

  • Implement sizes attribute

1.0

  • Stable API
  • Correct implementation of match method
  • Verify srcset feature detection
  • ie8 & up browser support (w/React polyfills only)
  • Performance optimizations
  • Ismorphic support
  • 100% test coverage
  • Travis CI

To be discussed

  • PictureContainer
  • Karma tests

2.0

  • Picture element
  • Source element

References

Alternative libraries

Acknowledgements

  • React's excellent library & documentation
  • Ryan Florence's components on github which were stolen to start up (webpack setup, browserify, scripts)
  • This excellent article

Keywords

FAQs

Package last updated on 28 Aug 2015

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