Skip to main content Skip to docs navigation

Plugins - FloatingUI

On this page

Floating UI

By default, @popperJS/core is required for the popper to work correctly. Alternatively, we can remove popper and use FloatingUI by creating a plugin that handles the popup creation.


import { computePosition } from '@floating-ui/dom';

const datetimepicker1 = new tempusDominus.TempusDominus(document.getElementById('datetimepicker1'));

datetimepicker1.display.createPopup = computePosition(element, widget, options).then(({ x, y }) => {
    Object.assign(widget.style, {
      left: `${x}px`,
      top: `${y}px`,
      position: 'absolute',
    });
  });