@atlaskit/popper
Version:
A wrapper for React Popper for situations which require a bespoke popup where other ADS components are deemed unsuitable
42 lines (41 loc) • 1.8 kB
TypeScript
import React from 'react';
import { type Placement, type VirtualElement } from '@popperjs/core';
import { type PopperChildrenProps, type PopperProps } from 'react-popper';
export { placements } from '@popperjs/core';
export type { Placement, VirtualElement } from '@popperjs/core';
export type { ManagerProps, ReferenceProps, PopperProps, PopperArrowProps, PopperChildrenProps, StrictModifier, Modifier, } from 'react-popper';
type Offset = [number | null | undefined, number | null | undefined];
export interface CustomPopperProps<Modifiers> {
/**
* Returns the element to be positioned.
*/
children?: (childrenProps: PopperChildrenProps) => React.ReactNode;
/**
* Distance the popup should be offset from the reference in the format of [along, away] (units in px).
* Defaults to [0, 8] - which means the popup will be 8px away from the edge of the reference specified
* by the `placement` prop.
*/
offset?: Offset;
/**
* Which side of the Reference to show on.
*/
placement?: Placement;
/**
* Replacement reference element to position popper relative to.
*/
referenceElement?: HTMLElement | VirtualElement;
/**
* Additional modifiers and modifier overwrites.
*/
modifiers?: PopperProps<Modifiers>['modifiers'];
/**
* Placement strategy used. Can be 'fixed' or 'absolute'
*/
strategy?: PopperProps<Modifiers>['strategy'];
/**
* Determines if the popper will have a `max-width` and `max-height` set to
* constrain it to the viewport.
*/
shouldFitViewport?: boolean;
}
export declare function Popper<CustomModifiers>({ children, offset, placement, referenceElement, modifiers, strategy, shouldFitViewport, }: CustomPopperProps<CustomModifiers>): React.JSX.Element;