1 | :toc: macro
|
2 | :toc-title:
|
3 | :toclevels: 99
|
4 |
|
5 | # react-popover
|
6 |
|
7 | image:https://travis-ci.org/littlebits/react-popover.svg?branch=master["Build Status", link="https://travis-ci.org/littlebits/react-popover"]
|
8 |
|
9 |
|
10 | toc::[]
|
11 |
|
12 |
|
13 |
|
14 | ## React Versions Support
|
15 |
|
16 | `react-popover` `>= 0.5.0` supports React 16 while `react-popover` `< 0.5.0` works with React `15.x.x` and likely lower. There is no plan to support older versions of this library with back-ported patches and PRs for that purpose are not welcome since it increases maintenance for the authors.
|
17 |
|
18 | ## Installation
|
19 |
|
20 | ```
|
21 | yarn add react-popover
|
22 | ```
|
23 |
|
24 | ## Examples
|
25 |
|
26 | Look at the link:https://littlebits.github.io/react-popover[stories in our storybook].
|
27 |
|
28 | ## API
|
29 |
|
30 | ### `export default` `Popover(props, target)`
|
31 |
|
32 | #### `props :: {...}`
|
33 |
|
34 | ---
|
35 |
|
36 | ##### `body :: Node | Array Node`
|
37 | The `popover` content.
|
38 |
|
39 | ---
|
40 |
|
41 | ##### `isOpen :: Boolean`
|
42 | Determines Whether or not the popover is rendered.
|
43 |
|
44 | ---
|
45 |
|
46 | ##### `preferPlace :: Enum String | Null`
|
47 | 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:
|
48 |
|
49 | `above | right | below | left` :: Prefer an explicit side.
|
50 | `row | column` :: Prefer an orientation.
|
51 | `start | end` :: Prefer an order.
|
52 | `null` :: No preference, automatic resolution. This is the default.
|
53 |
|
54 | ---
|
55 |
|
56 | ##### `place :: String | Null`
|
57 | 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.
|
58 |
|
59 | ---
|
60 |
|
61 | ##### `onOuterAction :: (Event) -> Void`
|
62 | 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.
|
63 |
|
64 | ---
|
65 |
|
66 | ##### `refreshIntervalMs :: Number | Falsey`
|
67 | 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.
|
68 |
|
69 | ---
|
70 |
|
71 | #### `enterExitTransitionDurationMs :: Number | Falsey`
|
72 | The amount of time in milliseconds that it takes to complete the enter and exit animation. Defaults to '500'.
|
73 |
|
74 | ---
|
75 |
|
76 | #### `tipSize :: Number`
|
77 | Defines the size of the tip pointer. Use .01 to disable tip. Defaults to '7'.
|
78 |
|
79 | ---
|
80 |
|
81 | ##### Standard
|
82 |
|
83 | * Properties like `className` and `style`.
|
84 |
|
85 |
|
86 | ---
|
87 |
|
88 | #### `target :: ReactElement`
|
89 |
|
90 | - The React Element that this popover will orient itself around. `target` `rendering tree` is unaffected. `Popover` _will_ become its `owner`.
|
91 |
|
92 | ---
|
93 |
|
94 | #### `appendTarget :: DOMNode`
|
95 |
|
96 | - The DOM node which this popover will be appended to. Defaults to 'document.body'.
|