Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-planet
Advanced tools
A react lib for building circular menus in a very easy and handy way.
A react lib for building circular menus in a very easy and handy way.
Live-Demo: STORYBOOK
Read the full story @ Medium or innFactory-Blog
npm install --save react-planet
import { Planet } from 'react-planet';
export function MyPlanet() {
return (
<Planet
centerContent={
<div
style={{
height: 100,
width: 100,
borderRadius: '50%',
backgroundColor: '#1da8a4',
}}
/>
}
open
autoClose
>
<div
style={{
height: 70,
width: 70,
borderRadius: '50%',
backgroundColor: '#9257ad',
}}
/>
<div
style={{
height: 70,
width: 70,
borderRadius: '50%',
backgroundColor: '#9257ad',
}}
/>
</Planet>
);
}
<Planet centerContent={div style={...yourStlye}/>}
open
orbitRadius={120}
rotation={30}
...
>
<Planet
orbitStyle={(defaultStyle) => ({
...defaultStyle,
borderWidth: 4,
borderStyle: 'dashed',
borderColor: '#6f03fc',
})}
centerContent={<div className={classes.planetSmall} />}
open
>
<div className={classes.satellite1} />
<div className={classes.satellite2} />
<div className={classes.satellite3} />
</Planet>
<Planet
// set one of the orientations
satelliteOrientation="INSIDE"
<Planet
dragablePlanet
dragRadiusPlanet={20}
bounce
Nested planets
Code: /src/stories/Planet.stories.tsx
<Planet
centerContent={<YourButton0 />}
hideOrbit
autoClose
orbitRadius={60}
bounceOnClose
rotation={105}
// the bounce direction is minimal visible
// but on close it seems the button wobbling a bit to the bottom
bounceDirection="BOTTOM"
>
<YourButton1 />
<YourButton2 />
<YourButton3 />
<div />
<div />
<div />
<div />
</Planet>
<Planet
mass={4}
tension={500}
friction={19}
name | type | example /default | description |
---|---|---|---|
centerContent | React.Node? | The planet component | |
orbitRadius | number? | 120 | How far the satellites are away from the planet |
open | boolean? | false | Set the open/close state from outside |
autoClose | boolean? | false | If true the planet handles the open/close state by itself |
hideOrbit | boolean? | false | If true the orbit is hidden / not rendered |
rotation | number? | 0 | The angle for the rotation of all satellites around the planet |
satelliteOrientation | DEFAULT INSIDE OUTSIDE READABLE | undefined / DEFAULT | The angle for the rotation of one satellite itself |
dragableSatellites | boolean? | false | If true you can click and drag a satellite |
dragRadiusSatellites | number? | 12 | Defines how much you can drag the satellites |
dragablePlanet | boolean? | false | If true you can click and drag the planet |
dragRadiusPlanet | number? | 12 | Defines how much you can drag the planet |
bounce | boolean? | false | If true the planet bounces on open and close |
bounceOnOpen | boolean? | false | If true the planet bounces only on open |
bounceOnClose | boolean? | false | If true the planet bounces only on close |
bounceRadius | number? | 3 | Defines how much the planet bounces |
bounceDirection | TOP BOTTOM LEFT RIGHT | undefined | On hight bounceRadius you can see a direction |
tension | number? | 500 | a react-spring animation physic value |
friction | number? | 17 | a react-spring animation physic value |
mass | number? | 1 | a react-spring animation physic value |
orbitStyle | (default: CSSProperties)=>CSSProperties | () => ({borderWidth: 4}) | You can override or set a new style for the orbit |
onClick | (e: MouseEvent)=>void | ()=>{} | The function is triggered if you click on the centerComponent |
onClose | (e: MouseEvent)=>void | ()=>{} | The function is triggered if the planet wants to close |
npm install
npm start
FAQs
A react lib for building circular menus in a very easy and handy way.
The npm package react-planet receives a total of 329 weekly downloads. As such, react-planet popularity was classified as not popular.
We found that react-planet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.