Skip to content

Latest commit

 

History

History
105 lines (93 loc) · 2.82 KB

README.md

File metadata and controls

105 lines (93 loc) · 2.82 KB

react-radial

By Mode Lab

Intro

This is a straightforward, customizable radial menu, built with React and Resonance (a library that allows React and D3js to play along nicely).

The radial component is built with SVG, and can be ported into a div, canvas, WebGL scene, etc. We use radial menus for 3D interaction often, and decided to build a generic component for future use. The demo file is an interactive environment for defining how you want the radial menu to look. Check it out here.

demo

Getting Started

Install the component into your project

npm install --save react-radial

Load the component into your app

import React from 'react';
import { ReactRadial } from 'react-radial';

class Component extends React.Component {
  render() {
    return <ReactRadial />;
  }
}

Remmeber to click on your canvas/div after loading the page (the radial menu does not load automatically). Please post any issues.

react-radial attributes

Name Type Default Description
buttons array ["button1",...(5)] an array of strings representing each button's label
buttonFunctions array [() => console.log('clicked button 1'),...(5)] an array of functions triggered by clicking each button
duration number (ms) 400 duration of transition
delay number (ms) 80 delay per button in transition
innerRadius number (px) 20 donut hole size
outerRadius number (px) 120 distance from outside of donut hole to outside of donut
strokeWidth number 2 stroke width
stroke color 'rgba(255,255,255,1)' stroke color
fill color 'rgba(0,0,0,.8)' fill color