UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

33 lines 1.12 kB
import { Dimensions } from "../floating-ui-react/types.js"; /** * Allows the element to automatically resize based on its content while supporting animations. */ export declare function usePopupAutoResize(parameters: UsePopupAutoResizeParameters): void; interface UsePopupAutoResizeParameters { /** * Element to resize. */ popupElement: HTMLElement | null; positionerElement: HTMLElement | null; /** * Whether the popup is mounted. */ mounted: boolean; content: unknown; /** * Whether the auto-resize is enabled. This function runs in an effect and can safely access refs. */ enabled?: () => boolean; /** * Callback fired immediately before measuring the dimensions of the new content. */ onMeasureLayout?: () => void; /** * Callback fired after the new dimensions have been measured. * * @param previousDimensions Dimensions before the change, or `null` if this is the first measurement. * @param newDimensions Newly measured dimensions. */ onMeasureLayoutComplete?: (previousDimensions: Dimensions | null, newDimensions: Dimensions) => void; } export {};