autoUpdate.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import type { ReferenceElement, FloatingElement } from './types';
  2. export interface Options {
  3. /**
  4. * Whether to update the position when an overflow ancestor is scrolled.
  5. * @default true
  6. */
  7. ancestorScroll: boolean;
  8. /**
  9. * Whether to update the position when an overflow ancestor is resized. This
  10. * uses the native `resize` event.
  11. * @default true
  12. */
  13. ancestorResize: boolean;
  14. /**
  15. * Whether to update the position when either the reference or floating
  16. * elements resized. This uses a `ResizeObserver`.
  17. * @default true
  18. */
  19. elementResize: boolean;
  20. /**
  21. * Whether to update on every animation frame if necessary. Optimized for
  22. * performance so updates are only called when necessary, but use sparingly.
  23. * @default false
  24. */
  25. animationFrame: boolean;
  26. }
  27. /**
  28. * Automatically updates the position of the floating element when necessary.
  29. * @see https://floating-ui.com/docs/autoUpdate
  30. */
  31. export declare function autoUpdate(reference: ReferenceElement, floating: FloatingElement, update: () => void, options?: Partial<Options>): () => void;