1.7.3 • Published 8 days ago

react-disks v1.7.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

react-disks

A shared react component for a stack of rotatable disks containing text.

If an m×n array of text items is passed to the component, m disks will render with n items evenly spaced around each disk.

Installation

npm install react-disks

Please note that dependencies of this package require React 18.0.0 or later.

Example

import ReactDisks from 'react-disks';

function App() {
  return (
    <ReactDisks
      disksText={[['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h'], ['i', 'j', 'k', 'l']]}
      onRotate={(rotatedDisksText) => console.log(rotatedDisksText)}
      theme={{main: "magenta", light: "plum", dark: "darkmagenta"}}
      disabled={false}
      swipeMode={false}
      swipeContainer={".someContainer"}
      darkMode={false}
    />
  );
}

export default App;

Props

PropTypeRequiredDescription
disksText2D arrayyesText to be displayed in each disk
onRotatefunctionnoFunction called after a disk is rotated (use to obtain new order of text)
themeobjectnoComponent colouring (options: main, light, and dark)
disabledbooleannoWhether the disks should be disabled
swipeModebooleannoWhether the disks are rotated via swipe gestures
swipeContainerstringnoSelector for a container to restrict swipe gesture detection
darkModebooleannoWhether the component theming should be dark or light