Skip to content

websdotcom/react-popover

 
 

Repository files navigation

react-popover

Installation

npm install --save react-popover

Demo

There is a demo that you can see here. To run it locally do npm start. If you do not see logs in the console refresh the browser once (jasonkuhrt#35).

API

export default Popover(props)

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`.


isOpen :: Boolean

Determines Whether or not the popover is rendered.


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 :: Function

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. * Plus support for standard props…​: className, style


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 :: DOM Node
  • The existing DOM node that this popover will orient itself around.


align :: String | Null

Like preferPlace except that the given place is a requirement. The resolver becomes scoped or disabled. Valid values are:

start

Centers the popover on the top/left corner of its targeted edge.

center

Default value. Centers the popover relative to its target.

end

Centers the popover on the bottom/right corner of its targeted edge.


offsetX :: Number | 0

Number of pixels to offet the final popover position by horizontally.


offsetY :: Number | 0

Number of pixels to offet the final popover position by vertically.

About

A specification backed popover for ReactJS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.3%
  • CoffeeScript 0.7%