Giter Club home page Giter Club logo

react-dropdown-overflow's Introduction

Links

example: https://github.com/dydokamil/react-dropdown-example

demo: https://dydokamil.github.io/react-dropdown-example/

npm: https://www.npmjs.com/package/react-dropdown-overflow

Demo

alt text

Installation

yarn add react-dropdown-overflow

or

npm install react-dropdown-overflow

Importing

import Dropdown from 'react-dropdown-overflow'

Usage

import Dropdown from 'react-dropdown-overflow'

class MyComponent extends React.Component {
  render() {
    <Dropdown dropdown={
      <div className='dropdown-list'>
        <ul>
         <li>item1</li>
         <li>item2</li>
         <li>item3</li>
       </ul>
      </div>
    }>
      <button>Toggler</button>
    </Dropdown>
  }
}

Props

mode?: "hover" | "click" = "hover"

Sets the behavior of the toggling element. Defaults to hover. Valid values are:

hover | click :: Whether the dropdown is triggered with a mouse click or on hover event.


children: ReactNode

A React component responsible for the toggling of the dropdown.


dropdown: ReactNode

A React component to be displayed as a dropdown.


positioning?: "center" | "left" | "right" = "left"

A string prop responsible for the positioning of the menu. Valid values are:

left | center | right :: The position of the dropdown menu.


zIndex?: "auto" | number = "auto"

A number specifying the z-index of the dropdown. Valid values are numbers.


hasClickOutsideListener?: boolean = false

A boolean prop specifying whether the dropdown should be closed when the mouse event is located outside of the entire component. Useful with click mode.


wrapperId?: string = undefined

id of the newly created element wrapping the children prop.


className?: string = "dropdown"

Class name of the newly created element wrapping the dropdown.


dropdownWrapperId?: string = undefined

id of the newly created element wrapping the dropdown.


isOpen?: boolean = undefined

A boolean prop responsible for the state of the component (closed/open). Valid values are:

true | false :: Whether the menu is visible.

WARNING: This changes the component from an uncontrolled to a controlled one.

react-dropdown-overflow's People

Contributors

tropical32 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.