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

react-clip-path

v0.0.6

Published

react-clip-path is a simple React based package to create shapes using CSS clip-path.

Downloads

70

Readme

react-clip-path

react-clip-path is a React-based open-source project to create shapes declaratively using CSS clip-path property. It is available as NPM to download and install.

🔥 Why do you need this?

You may need react-clip-path when,

  • You need to show lightweight shapes in your React app.
  • You may not want to rely on any external graph or chart libraries to create shapes.
  • You may want to create some custom shapes using a polygon, paths, etc.
  • You need to create shapes declaratively by extending the out-of-the-box schema.

💻 Live Demo

A Live demo of the component is available here, 💻 CLICK FOR DEMO

Demo Status on Netlify

Netlify Status

⭐ Want to Motivate?

Who doesn't need motivations? Please give the repository a star(⭐) to motivate.

Many Thanks to all the Stargazers who has supported this project with stars(⭐)

Stargazers repo roster for @atapas/react-clip-path

⚒️ How to use?

This section talks about the installation, usages, and configurations. Make sure you have Node.js(version 12.7.0 or higher) installed.

Install

To install, use the following command from your command prompt,

npm install react-clip-path

# Alternatively using yarn
yarn add react-clip-path

Import

Next is to import the component from the library.

First import the Shape component,

import Shape from 'react-clip-path';

Usage

After import, we can now use it in any React component.

<Shape
    name="Circle"
    id="circle-shape-id"
    width="300px"
    height="300px"
    showLabel={true}
    showShadow={true}
    handleClick={() => someFunction()}
/>

Properties & Configuration

This section provides details about the properties(props).

Schema & Extending it

The react-clip-path depends on a schema file to get the shape information. You can extend the schema by introducing a new shape definition. Shape information contains,

  • name of the shape
  • shape type
  • clip-path code of the shape
  • number of vertices
  • number of edges
  • Any optional notes about the shape.

Here is an example of the circle shape in the schema file,

{
  'name': 'Circle',
  'type': 'circle',
  'formula': 'circle(50% at 50% 50%)',
  'vertices': 0,
  'edges': 0,
  'notes': 'A circle is a round shaped figure that has no corners or edges. In geometry, a circle can be defined as a closed, two-dimensional curved shape.'
}

The same schema file also contains a few utility methods. You can import them as,

import { getShape } from 'react-clip-path/schema';

getShape('Circle'); // returns the details of the Circle shape.

🏷️ License

Copyright © 2021 by Tapas Adhikary

This project is licensed under MIT license.