npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

undraw-js

v1.0.6

Published

Js library for Undraw illustration

Downloads

1,477

Readme

Welcome to this library

Undraw-js is a library allow you to add undraw.co illustration to web page with a specifique color

How to use it ?

  • Installation

    <script src="https://unpkg.com/[email protected]/index.min.js"></script>

    or use yarn or npm

    $ yarn add undraw-js
    $ npm i undraw-js
  • Add some attribute to your img element

    <img data-ujs-name="Ukraine" data-ujs-color="#f00" />

    About attributes

    |Options | Description | Required| |--------|-------------|---------| |data-ujs-name| Input here the name of the illustration| yes | |data-ujs-color| Input here the main color code you want| no | |data-ujs-fall-img|The image link to set as the source of the img element if the illustration failed to load.| no |

  • Add this script to the page

    <script>
        UndrawJS.init()
    </script>

    or

      import UndrawJs from 'undraw-js'
      (new UndrawJs()).init()

More customisation

You can provide options to Undraw object

    const options = {
        nameAttr: "data-ujs-name", // Custom attribute of nodes that specifies the name of the illustration
        colorAttr: "data-ujs-color", // Custom attribute of nodes that specifies the main color
        doneAttr: "data-ujs-done", // Custom attribute of nodes that specifies if the illustration is addded to the node
        fallbackAttr: "data-ujs-fall-img", // Custom attribute of nodes that specifies the fall image
        defaultColor: "#f00" // To specify a default color
    };

    UndrawJS.init(options); // or (new UndrawJs()).init(options) for module user

How to find illustration name ?

Go to undraw.co find illustration you need and copy its name

Notes

Only the illustrations you add to your page are loaded.

Illustration not loaded ? Undraw is constantly evolving. If the illustration does not load, perhaps the version of undraw-js you are using is deployed before the creation of this illustration. To fix this, see if there is a version of undraw-js higher than the version you are using, if it is the last version you are using then wait for a new update. There are over 1300 illustrations that you can use