1.0.7 • Published 12 months ago

@tiny-placeholder/react v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@tiny-placeholder/react

Table of Contents

Project Overview

This is a tiny library for use when you need simple placeholder images.
It is available for use in React projects.

The library provides two components:

  • PlaceholderImage component for displaying placeholder images
  • PlaceholderImageDownloader component for downloading placeholder images

Features

Both components offer the following features:

  • Set desired width and height.
  • Choose desired shape (rectangle, triangle, circle).
  • Set desired background color.
  • Insert text in the center of the image with desired color and size.

Installation / Usage

npm:

$ npm install @tiny-placeholder/react

yarn:

$ yarn add @tiny-placeholder/react

pnpm:

$ pnpm add @tiny-placeholder/react

You can install @tiny-placeholder/react in your project using a package manager.

Example code:

const options = createPlaceholderOptions({
  width: 200,
  height: 200,
  backgroundColor: '#cccccc',
  textColor: '#333333',
  text: 'Placeholder',
  fontSize: 20,
  fontFamily: 'Arial, sans-serif',
  borderWidth: 0,
  borderColor: '#000000',
  borderStyle: 'solid',
  borderRadius: 0,
  shape: 'rectangle',
})

<PlaceholderImage
  options={options}
  alt="This is a placeholder image."
/>

<PlaceholderImageDownloader
  options={options}
  component={<Button/>}
/>

const Button = () => {
  return <button>Download</button>
}

1. createPlaceholderOptions

Use the createPlaceholderOptions function to generate options with type support.

2. PlaceholderImage

The PlaceholderImage component provides an image tag with the configured options props.

3. PlaceholderImageDownloader

The PlaceholderImageDownloader component provides an anchor (a) tag to download the generated image using the configured options props. You can define the download button's appearance using the component prop.

example site

example code

License

This project is licensed under the terms of the MIT license.

1.0.7

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago