Socket
Book a DemoInstallSign in
Socket

react-undraw

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-undraw

React component for unDraw illustrations.

latest
Source
npmnpm
Version
2.0.3
Version published
Weekly downloads
290
11.97%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Version CI Dependency Status Dev Dependency Status

React unDraw

React component for unDraw illustrations.

Table of Contents

Features

  • 🚀 Works with any illustration from unDraw.
  • 🎨 Customize colors with props.
  • 🎉 Written in TypeScript.
  • 🎁 Smaller bundles by only including what you need.

Installation

npm install react-undraw --save

Usage

import Undraw from 'react-undraw';

// optionally override default props
Undraw.defaultProps.primaryColor = 'darkblue';

<Undraw name="coding" />;

Props:

PropTypeDescriptionDefault
namestringIllustration file name (without extension).n/a
primaryColorstringIllustration primary color.#6c63ff
heightstringIllustration height.250px

Illustrations

Bring your own illustrations! To comply with the updated unDraw license, we can't bundle the illustrations with this package 😞 However, this means you can always use the latest illustrations! 😎

Here's what you need to do:

  • Download any illustrations you want from unDraw.
    • No need to change the color before download, use primaryColor prop instead.
    • Optional: rename file to remove prefix/suffix (undraw_barbecue_3x93.svg => barbecue.svg).
    • The name prop will need to match your file name.
  • Put SVG files in an undraw folder at the root of your project.
  • Add react-undraw-cli to your build and/or start script:
    • "prebuild": "react-undraw-cli"
    • or ... "build": "react-undraw-cli && react-scripts build"

Example project structure:

package.json
src/
 ...
undraw/
  coding.svg
  hologram.svg
  ice_cream.svg
  ...

Development

npm install
npm run build

Keywords

undraw

FAQs

Package last updated on 17 Feb 2021

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