Skip to content

Commit

Permalink
Document getAnchorRect prop for Popover component. (#17709)
Browse files Browse the repository at this point in the history
  • Loading branch information
desaiuditd authored Apr 9, 2020
1 parent c10a0bc commit acafff9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/components/src/popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,22 @@ Opt-in prop to show popovers fullscreen on mobile, pass `false` in this prop to

### anchorRect

A custom `DOMRect` object at which to position the popover.
A custom `DOMRect` object at which to position the popover. `anchorRect` is used when the position (custom `DOMRect` object) of the popover needs to be fixed at one location all the time.

- Type: `DOMRect`
- Required: No

### getAnchorRect

A callback function which is used to override the anchor value computation algorithm. `anchorRect` will take precedence over this prop, if both are passed together.

If you need the `DOMRect` object i.e., the position of popover to be calculated on every time, the popover re-renders, then use `getAnchorRect`.

`getAnchorRect` callback function receives a reference to the popover anchor element as a function parameter and it should return a `DOMRect` objcet.

- Type: `Function`
- Required: No

## Methods

### refresh
Expand Down

0 comments on commit acafff9

Please sign in to comment.