Giter Site home page Giter Site logo

jakub-zawislak / react-bulma-dropdown Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.39 MB

React Bulma dropdown, with an auto-height, scroll and portal support.

Home Page: https://jakub-zawislak.github.io/react-bulma-dropdown/

License: MIT License

JavaScript 7.93% HTML 26.33% TypeScript 60.24% SCSS 5.50%

react-bulma-dropdown's Introduction

React Bulma dropdown

It's a Bulma's dropdown, with an auto-height, scroll and portal support.

The .dropdown-menu is not simply rendered below the .dropdown-trigger, but is portaled to another DOM element. Thanks to that your dropdown will work in element that has overflow:hiden or overflow:scroll CSS style.

The .dropdown-menu is auto resizing to match the portal's bottom edge.

Installation

yarn add react-bulma-dropdown

You have also to include the dist/main.css file.

Basic example

import Dropdown from 'react-bulma-dropdown'

<Dropdown trigger="Choose">
  <a href="#" className="dropdown-item">Item A</a>
  <a href="#" className="dropdown-item">Item B</a>
  <a href="#" className="dropdown-item">Item C</a>
</Dropdown>

You can find more examples in Storybook.

Properties

Property Type Description Default
children ReactNode The .dropdown-content's content
trigger string or ReactNode The trigger rendered in the .dropdown-trigger "Open dropdown"
portal null or HTMLElement Element to which the .dropdown-menu will be portaled. If null, then it will be portaled to the end of the document null
className string Optional CSS class name for the .dropdown-menu's wrapper ""
openOnMount boolean Open the .dropdown-menu on mount false
isAnimated boolean Animate the .dropdown-menu opening true
hideOnLinkClick boolean Close the .dropdown-menu after clicking an a.dropdown-item true
margin integer Min. distance between bottom of the dropdown and bottom of the portal 20
controlRef (ref: ControlRefType) => void A ref that consist object with open and close methods. undefined

Development

yarn run storybook

react-bulma-dropdown's People

Contributors

jakub-zawislak avatar

Stargazers

 avatar

Watchers

 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.