Skip to content

tripphamm/react-placeholder-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌄 React Placeholder Image

Quickly mock up UI's with placeholder images.

CustomPlaceholder

[Powered by https://placeholder.com]

Usage

Use the CustomPlaceholder React component

import { CustomPlaceholder } from 'react-placeholder-image';

Simple placeholder image

// simple, square image (width and height are required)
<CustomPlaceholder width={200} height={200} />

Complex placeholder image

// image with custom background-color, text, textColor, width, and height
<CustomPlaceholder
  width={200}
  height={100}
  backgroundColor="#123456"
  textColor="#ffffff"
  text="Hello World!"
/>

or simply generate an image URL to use in your own image component

import { generateCustomPlaceholderURL } from 'react-placeholder-image';

// simple sized image
const placeholderImageURL = generateCustomPlaceholderURL(200, 200);

// pass options to customize the background-color, text, and height
const otherPlaceholderImageURL = generateCustomPlaceholderURL(200, 100, {
  backgroundColor: '#123456',
  textColor: '#ffffff',
  text: 'Hello World!',
});

PhotoPlaceholder

[Powered by https://picsum.photos]

Usage

Use the PhotoPlaceholder React component

import { PhotoPlaceholder } from 'react-placeholder-image';

Simple photo placeholder image

// simple, square image (width and height are required)
<PhotoPlaceholder width={200} height={200} />

Grayscale photo placeholder image

// image with grayscale option
<PhotoPlaceholder width={200} height={100} grayscale />

or simply generate an image URL to use in your own image component

import { generatePhotoPlaceholderURL } from 'react-placeholder-image';

// simple sized image
const placeholderImageURL = generatePhotoPlaceholderURL(200, 200);

// pass options to get grayscale
const otherPlaceholderImageURL = generatePhotoPlaceholderURL(200, 100, {
  grayscale: true,
});

About

Quickly mock up UI's with placeholder images.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published