GithubHelp home page GithubHelp logo

react-popover2's Introduction

react-popover2

littlebits/react-popover successor.

Installation

npm install --save ataccama/react-popover2
yarn add ataccama/react-popover2

If you want to install already pre-build version, use dist branch:

npm install --save ataccama/react-popover2#dist
yarn add ataccama/react-popover2#dist

This fork

This fork makes use of BEM-style class names. A new prop className sets the base Block Name, with elements being named body and trigger. It also supports a modifiers prop, which is an array of strings that will be added to BEM class.

We've also removed the triangle (tip) on the popover. We'd rather create this with CSS.

API

export default Popover(props, target)

props :: {...}


body :: Node | Array Node

The popover content. Content is rooted (becomes children of) .Popover-body and thus body can be a single node or an array of nodes.


parent :: Node

Sets the parent element of the body attribute.


isOpen :: Boolean

Determines Whether or not the popover is rendered.


className :: String

Determines component Module Name for BEM-Style classes


modifiers :: String | Array String

Determines component Modifiers for BEM-Style classes


preferPlace :: Enum String | Null

Sets a preference of where to position the Popover. Only useful to specify placement in case of multiple available fits. Defaults to null. Valid values are:

above | right | below | left :: Prefer an explicit side. row | column :: Prefer an orientation. start | end :: Prefer an order. null :: No preference, automatic resolution. This is the default.


place :: String | Null

Like preferPlace except that the given place is a requirement. The resolver becomes scoped or disabled. It is scoped if the place is an orientation or order but disabled if it is a side. For example place: "row" scopes the resolver to above or below placement but place: "above" removes any need for the resolver.


onOuterAction :: (Event) -> Void

A callback function executed every time the user does an action (mousedown or touchstart) outside the DOM tree of both Popover and Target. A canonical use-case is to automatically close the Popover on any external user action.


refreshIntervalMs :: Number | Falsey

The polling speed (AKA time between each poll) in milliseconds for checking if a layout refresh is required. This polling is required because it is the only robust way to track the position of a target in the DOM. Defaults to 200. Set to a falsey value to disable.


target :: React Element

  • The React Element that this popover will orient itself around. target rendering tree is unaffected. Popover will become its owner.

react-popover2's People

Contributors

codinglawyer avatar iakovmarkov 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.