Packages

@floating-ui/react-dom

2.1.9 · 11 Jul 2026MIT112.9M / weekRepositoryHomepagenpmAtom feed

Your version

2.0.0

major30 Apr 2023Where it was published

2.1.9 is the newest release of 2.x.

In short

3 breaking2 new1 fixed

  • breaking

    Default x and y coordinates to 0 instead of null

  • breaking

    Remove deprecated top-level reference and floating ref setters

  • breaking

    whileElementsMounted type requires cleanup function

Release note

This release aims to simplify the API and remove some deprecated properties. If you've been using the refs.set* functions since their addition in January (1.2.0), then you can freely upgrade without changing any of your code.

Breaking Changes

  • breaking

    Default x and y coordinates to 0 instead of null

    isPositioned lets you know if the floating element has been positioned.

  • breaking

    Remove deprecated top-level reference and floating ref setters

    These are in the refs object:

    • reference -> refs.setReference

    • floating -> refs.setFloating

  • breaking

    whileElementsMounted type requires cleanup function

New Features

  • floatingStyles object

    Pre-configured positioning styles for the majority of cases:

    const {refs, floatingStyles} = useFloating();
    return <div ref={refs.setFloating} style={floatingStyles} />;
  • External element synchronization in the hook

    Avoid using layout effects:

    const {refs} = useFloating({
      elements: {
        // Either can be specified optionally
        reference: referenceElement,
        floating: floatingElement,
      },
    });
    
    // refs.setReference / refs.setFloating can be mix and matched

Bug Fixes

  • types: Allow null for arrow's element option