@economist/component-picture

Responsive picture element with support mulitple sources and dppx


License
MIT
Install
npm install @economist/component-picture@1.4.0

Documentation

component-picture

This component provides a responsive picture element with support multiple sources.

Simply feed it a list of images, their widths, heights and dppx and it'll pick the best image to use given the width and height of the container element.

Goals

  • Provide one unified interface for adding images with multiple dppx (ala )
  • Provide an abstracted interface for loading multiple crops and dppx of an image (ala breakpoints)
  • Decouple the notion of "media queries" from images - making a truly responsive element (not just browser-window responsive).

Usage

See example.es6 for how to use

Install

npm install --save @economist/component-picture;

Run tests

npm test;