Skip to content

stutrek/react-image-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-image-selector

This is a React component that wraps the imageSelector. It takes a set of cuts of images and fills in the src attribute of an image based on the size of the image.

Basic Usage

The Image component creates an <img>. The Cuts component never render, they hold data about the different cuts of the image.

import { Image, Cut } from 'react-image-selector';

export default MyImage extends React.Component {
	render () {
		return (<Image responsive={true}>
			<Cut
				width={200}
				height={400}
				src="/path/to/image.jpg"
				at2x="/path/to/retina/image.jpg"
			/>
			<Cut
				width={400}
				height={800}
				src="/path/to/image.jpg"
				at2x="/path/to/retina/image.jpg"
			/>
		</Image>)
	}
}

About

A responsive image selector for react

Resources

Stars

Watchers

Forks

Packages

No packages published