Interface AnchorPositionInfo

An info about the current target position around an anchor.

interface AnchorPositionInfo {
    anchorRect: DOMRect;
    arrowOffset: undefined | number;
    containerRect: DOMRect;
    maxHeight: number;
    maxWidth: number;
    targetPlacement:
        | "center"
        | "topLeft"
        | "topRight"
        | "top"
        | "bottomLeft"
        | "bottomRight"
        | "bottom"
        | "left"
        | "right";
    targetRect: DOMRect;
    x: number;
    y: number;
}

Properties

anchorRect: DOMRect

An anchor rect around which a target is positioned.

arrowOffset: undefined | number

An arrow offset, relative to a target.

undefined if targetPlacement isn't top, right, bottom or left.

containerRect: DOMRect

A bounding rect of a container that constrains target positioning.

maxHeight: number

The maximum height of a target, so it can fit into a container.

maxWidth: number

The maximum width of a target, so it can fit into a container.

targetPlacement:
    | "center"
    | "topLeft"
    | "topRight"
    | "top"
    | "bottomLeft"
    | "bottomRight"
    | "bottom"
    | "left"
    | "right"

The position of a target, relative to the anchor.

topLeft top topRight
left center right
bottomLeft bottom bottomRight
targetRect: DOMRect

A target rect.

x: number

A horizontal position of a target, relative to a window.

y: number

A vertical position of a target, relative to a window.