npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-draggable-menu

v0.1.0

Published

Draggable menu with dynamic options

Downloads

21

Readme

react-draggable-menu

Draggable menu with dynamic options to customise it as per user requirements.

A Node.js React package that gives draggable menu with dynamic options to make it custom as per user requirment. Also give a better user experience with better and flexible options.

Demo and Docs

Installation

The package can be installed via NPM:

npm install react-draggable-menu --save

yarn add react-draggable-menu

react-draggable-menu can be imported as follows

var DraggableMenu = require('react-draggable-menu');

OR

import DraggableMenu from 'react-draggable-menu';

Prerequisite

You need to include fontowesome script link in your index.html.

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">

Visit Font awesome icon list to choose your icon list.

Examples

Basic Example with all default props

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu />
    );
  }
}

export default App;

Example to pass the custom icon and data to menu

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
          menuIcon= {["fas fa-bars", '#fff', "#2196f3",0,'Main Menu']}
          menuList= {[
                       ["fab fa-affiliatetheme", '#fff', "#FBBD3B", 2,'item 1'], 
                       ["fas fa-ad", '#fff', "#4185F4", 3,'item 2'], 
                       ["fas fa-adjust", '#fff', "#48A853", 4,'item 3']
        ]}
        //icon name, color, background-color, id, tooltip-text
      />
    );
  }
}

export default App;

Example to show handleChange and isOpen method of menu

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  handleChange=(data)=>{
    //do something here with data
  }
  isOpen=(value)=>{
    //do something here with value
  }
  render() {
    return (
      <DraggableMenu
          handleChange={this.handleChange}
          isOpen={this.isOpen}/>
    );
  }
}

export default App;

Example to open menu item horizontally (by default it show items vertically)

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      isVerticalOpen= {false}
      />
    );
  }
}

export default App;

Example to show menu item open by default initially

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      isMenuOpen= {true}
      />
    );
  }
}

export default App;

Example to set initial position of menu icon on screen

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      initialPosition= {{ margin: 'auto', top: 0, right: 0, bottom: 0, left: 0 }}
      //its default position, you camn change using css in this object
      />
    );
  }
}

export default App;

Example to set border color and its style

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      border={'1px solid #fff'}
      //you can pass any valid border property in this prop
      />
    );
  }
}

export default App;

Example to show drag menu to only right side

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      dragToRightOnly= {true}
      />
    );
  }
}

export default App;

Example to show drag menu to only left side

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      dragToLeftOnly= {true}
      />
    );
  }
}

export default App;

Example to show drag menu to only top side

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      dragToTopOnly= {true}
      />
    );
  }
}

export default App;

Example to show drag menu to only bottom side

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      dragToBottomOnly= {true}
      />
    );
  }
}

export default App;

Example to disable draggable menu

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      isDraggable= {false}
      />
    );
  }
}

export default App;

Example to stop closing menu items on ESC press from keyboard

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      closeOnEsc= {false}
      />
    );
  }
}

export default App;

Example to stop closing menu items on click outside menu

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      closeOnClick= {false}
      />
    );
  }
}

export default App;

Example to stop closing menu items on selection(click) of item from menu list

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      closeOnSelection= {false}
      />
    );
  }
}

export default App;

Example to show menu item list open for some time when page load and then close automatically

import React, { Component } from 'react';
import DraggableMenu from 'react-draggable-menu';

class App extends Component {

  render() {
    return (
      <DraggableMenu
      showMenuOpenForTime= {1000}
      //pass the values in miliseconds
      />
    );
  }
}

export default App;

Default parameter options value

    isVerticalOpen: true,
    dragToRightOnly: false,
    dragToLeftOnly: false,
    dragToTopOnly: false,
    dragToBottomOnly: false,
    isDraggable: true,
    isMenuOpen: false,
    initialPosition: {},
    closeOnEsc: true,
    closeOnClick: true,
    closeOnSelection: true,
    showMenuOpenForTime: 0,
    border:'1px solid #fff',
    menuIcon: ["fas fa-bars", '#fff', "#2196f3",0,'Main Menu'],
    menuList: [["fab fa-affiliatetheme", '#fff', "#FBBD3B", 2,'item 1'], ["fas fa-ad", '#fff', "#4185F4", 3,'item 2'], ["fas fa-adjust", '#fff', "#48A853", 4,'item 3'], ["fab fa-adn", '#fff', "#EA4335", 5,'item 4']]

Available options list

    isVerticalOpen: Boolean,
    dragToRightOnly: Boolean,
    dragToLeftOnly: Boolean,
    dragToTopOnly: Boolean,
    dragToBottomOnly: Boolean,
    isDraggable: Boolean,
    isMenuOpen: Boolean,
    initialPosition: Object,
    closeOnEsc: Boolean,
    closeOnClick: Boolean,
    closeOnSelection: Boolean,
    showMenuOpenForTime: Number,
    menuIcon: Array,
    menuList: Arrays,
    border: String,
    isOpen: Function,
    handleChange: Function