{"id":17063636,"url":"https://github.com/atapas/react-clip-path","last_synced_at":"2025-04-12T18:44:50.393Z","repository":{"id":49655722,"uuid":"352545067","full_name":"atapas/react-clip-path","owner":"atapas","description":"react-clip-path is a simple React-based package to create shapes declaratively using CSS clip-path property.","archived":false,"fork":false,"pushed_at":"2022-05-25T04:09:13.000Z","size":462,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T13:03:18.603Z","etag":null,"topics":["clip-path","css","css3","react","reactjs"],"latest_commit_sha":null,"homepage":"https://tapasadhikary.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atapas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["atapas"]}},"created_at":"2021-03-29T06:54:38.000Z","updated_at":"2025-02-23T14:31:10.000Z","dependencies_parsed_at":"2022-08-20T13:30:28.804Z","dependency_job_id":null,"html_url":"https://github.com/atapas/react-clip-path","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"atapas/react-package-publisher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atapas%2Freact-clip-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atapas%2Freact-clip-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atapas%2Freact-clip-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atapas%2Freact-clip-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atapas","download_url":"https://codeload.github.com/atapas/react-clip-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617240,"owners_count":21134190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clip-path","css","css3","react","reactjs"],"created_at":"2024-10-14T10:52:36.552Z","updated_at":"2025-04-12T18:44:50.372Z","avatar_url":"https://github.com/atapas.png","language":"JavaScript","funding_links":["https://github.com/sponsors/atapas"],"categories":[],"sub_categories":[],"readme":"# react-clip-path\n`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.\n\n# 🔥 Why do you need this?\nYou may need `react-clip-path` when,\n\n- You need to show lightweight shapes in your React app. \n- You may not want to rely on any external graph or chart libraries to create shapes.\n- You may want to create some custom shapes using a polygon, paths, etc.\n- You need to create shapes declaratively by extending the out-of-the-box schema.\n\n# 💻 Live Demo\nA Live demo of the component is available here, 💻 [CLICK FOR DEMO](https://react-clip-path.netlify.app/)\n\n## Demo Status on Netlify\n\n[![Netlify Status](https://api.netlify.com/api/v1/badges/6c1a6fc5-7887-431f-ac7c-3c14135e5e6b/deploy-status)](https://app.netlify.com/sites/react-clip-path/deploys)\n\n# ⭐ Want to Motivate?\nWho doesn't need motivations? Please give the repository a star(⭐) to motivate.\n\n## Many Thanks to all the `Stargazers` who has supported this project with stars(⭐)\n\n[![Stargazers repo roster for @atapas/react-clip-path](https://reporoster.com/stars/atapas/react-clip-path)](https://github.com/atapas/react-clip-path/stargazers)\n\n# ⚒️ How to use?\nThis section talks about the installation, usages, and configurations. Make sure you have Node.js(version 12.7.0 or higher) installed.\n## Install\nTo install, use the following command from your command prompt,\n\n```shell\nnpm install react-clip-path\n\n# Alternatively using yarn\nyarn add react-clip-path\n```\n\n## Import\nNext is to import the component from the library.\n\nFirst import the `Shape` component,\n\n```js\nimport Shape from 'react-clip-path';\n```\n## Usage\nAfter import, we can now use it in any React component.\n\n```js\n\u003cShape\n    name=\"Circle\"\n    id=\"circle-shape-id\"\n    width=\"300px\"\n    height=\"300px\"\n    showLabel={true}\n    showShadow={true}\n    handleClick={() =\u003e someFunction()}\n/\u003e\n```\n### Properties \u0026 Configuration\nThis section provides details about the properties(props).\n\u003cdetails open\u003e\u003csummary\u003eComponent Properties:\u003c/summary\u003e\n\u003cp\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e \u003cb\u003eProperty\u003c/b\u003e \u003c/td\u003e \n    \u003ctd\u003e \u003cb\u003eDescription\u003c/b\u003e \u003c/td\u003e\n    \u003ctd\u003e \u003cb\u003eRequired\u003c/b\u003e \u003c/td\u003e\n    \u003ctd\u003e \u003cb\u003eExample\u003c/b\u003e \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e id \u003c/td\u003e\n    \u003ctd\u003e The unique identifier of the shape \u003c/td\u003e\n    \u003ctd\u003e Yes \u003c/td\u003e\n    \u003ctd\u003e\n      Please pass any unique string as id.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e name \u003c/td\u003e\n    \u003ctd\u003e The Shape Name \u003c/td\u003e\n    \u003ctd\u003e Yes \u003c/td\u003e\n    \u003ctd\u003e\n  Supported Shapes(out-of-the-box) are, \u003ccode\u003eCircle\u003c/code\u003e, \u003ccode\u003eSquare\u003c/code\u003e, \u003ccode\u003eRectangle\u003c/code\u003e, \u003ccode\u003eRhombus\u003c/code\u003e, \u003ccode\u003eEllipse\u003c/code\u003e, \u003ccode\u003eTriangle\u003c/code\u003e, \u003ccode\u003eParallelogram\u003c/code\u003e, \u003ccode\u003eTrapezoid\u003c/code\u003e, \u003ccode\u003ePentagon\u003c/code\u003e, \u003ccode\u003eHexagon\u003c/code\u003e, \u003ccode\u003eHeptagon\u003c/code\u003e, \u003ccode\u003eOctagon\u003c/code\u003e, \u003ccode\u003eNonagon\u003c/code\u003e, \u003ccode\u003eDecagon\u003c/code\u003e, \u003ccode\u003eCross\u003c/code\u003e, \u003ccode\u003eStar\u003c/code\u003e, \u003ccode\u003eTag\u003c/code\u003e.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e formula \u003c/td\u003e\n    \u003ctd\u003e The shape's clip-path formula. Please pass a CSS clip-path value using inset, circle, ellipse, polygon\u003c/td\u003e\n    \u003ctd\u003e Yes - It is required if name is not passed.  \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cul\u003e\n        \u003cli\u003ecircle(50% at 50% 50%)\u003c/li\u003e\n        \u003cli\u003epolygon(10% 10%, 90% 10%, 90% 90%, 10% 90%)\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e backgroundColor \u003c/td\u003e\n    \u003ctd\u003e The color of the shape \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      Any valid hex color code or rgb color code. The default color code is, \u003ccode\u003e#12a8d6\u003c/code\u003e.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e height \u003c/td\u003e\n    \u003ctd\u003e The height of the shape \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      The default value is \u003ccode\u003e100px\u003c/code\u003e.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e width \u003c/td\u003e\n    \u003ctd\u003e The width of the shape \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      The default value is \u003ccode\u003e100px\u003c/code\u003e.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e showShadow \u003c/td\u003e\n    \u003ctd\u003e pass \u003ccode\u003etrue\u003c/code\u003e if you want to show outside part of the clipped area. \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ccode\u003efalse\u003c/code\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e text \u003c/td\u003e\n    \u003ctd\u003e Any text label about the shape \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      The label of the shape.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e showLabel \u003c/td\u003e\n    \u003ctd\u003e Show the text label if \u003ccode\u003etrue\u003c/code\u003e. \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ccode\u003etrue\u003c/code\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\n  \u003ctr\u003e\n    \u003ctd\u003e handleClick \u003c/td\u003e\n    \u003ctd\u003e Pass a function to call when user clicks on the shape. \u003c/td\u003e\n    \u003ctd\u003e No \u003c/td\u003e\n    \u003ctd\u003e\n      \u003ccode\u003ehandleClick={() =\u003e someFunction()}\u003c/code\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\n# Schema \u0026 Extending it\nThe `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,\n\n- name of the shape\n- shape type\n- clip-path code of the shape\n- number of vertices\n- number of edges\n- Any optional notes about the shape.\n\nHere is an example of the `circle` shape in the schema file,\n\n```js\n{\n  'name': 'Circle',\n  'type': 'circle',\n  'formula': 'circle(50% at 50% 50%)',\n  'vertices': 0,\n  'edges': 0,\n  '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.'\n}\n```\n\nThe same schema file also contains a few utility methods. You can import them as,\n\n```js\nimport { getShape } from 'react-clip-path/schema';\n\ngetShape('Circle'); // returns the details of the Circle shape.\n```\n\n# 🏷️ License\nCopyright © 2021 by [Tapas Adhikary](https://tapasadhikary.com/)\n\nThis project is licensed under MIT license.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatapas%2Freact-clip-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatapas%2Freact-clip-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatapas%2Freact-clip-path/lists"}