0.0.10 • Published 1 month ago

react-use-polygon v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

react-use-polygon

landing-page.png

What is react-use-polygon?

Simple and easy ways of rendering polygon, shapes and geometry primitives in React using hooks 🚀

It will provide basic primitive data for user, and enable user to render them with SVG and canvas.

For more details, please view our website.

Features

  • Full of 2D polygons, i.e. circle, triangle, rectangle and more
  • Special spaces, i.e. kite and star
  • Other geometry primitives, like: lines, curves, arcs
  • Lightweight and tree-shakable
  • Built with Typescript
  • Proper documentation

Install

Using npm:

npm install react-use-polygon

Or yarn:

yarn add react-use-polygon

Or pnpm:

pnpm add react-use-polygon

Example Usage

import { usePolygon } from "react-use-polygon";

// Pentagon
const { svgPath } = usePolygon({ sides: 5 });

// Render it later using SVG path
<svg>
  <path d={svgPath} />
</svg>

TODOs 📒

  • More primitives?
  • More utilities for more complex UI usage
  • More helpers for rendering

Credits

License

MIT

0.0.10

1 month ago

0.0.9

1 month ago

0.0.8

1 month ago

0.0.7

1 month ago

0.0.6

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.3

1 month ago

0.0.2

1 month ago

0.0.1

1 month ago