From acafff97f73dc8178f27c5feb38474afd18e889f Mon Sep 17 00:00:00 2001 From: Udit Desai Date: Thu, 9 Apr 2020 19:59:30 +1000 Subject: [PATCH] Document getAnchorRect prop for Popover component. (#17709) --- packages/components/src/popover/README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/components/src/popover/README.md b/packages/components/src/popover/README.md index be0eca3d77358..6dc54e4e1f53c 100644 --- a/packages/components/src/popover/README.md +++ b/packages/components/src/popover/README.md @@ -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