JSPM

@fluentui/react-positioning

0.0.0-nightly-20250307-0407.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 203275
  • Score
    100M100P100Q164733F
  • License MIT

A react wrapper around Popper.js for Fluent UI

Package Exports

    Readme

    @fluentui/react-positioning

    A react hook wrapper around Popper.js for Fluent UI.

    Usage

    import React from 'react';
    import { usePopper } from '@fluentui/react-positioning';
    
    function PopupExample: React.FC = ({ children }) => {
      const {targetRef, containerRef} = usePopper();
      const [open, setOpen] = React.useState(false);
    
      const onClick = () => setOpen(s => !s);
      return (
        <>
          <button ref={targetRef} onClick={onClick}> Toggle popup </button>
          { open && <div ref={containerRef}>{children}</div> }
        </>
      )
    }