Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react-popper-2

import React, { useState } from 'react';
import { usePopper } from 'react-popper';

const Example = () => {
  const [referenceElement, setReferenceElement] = useState(null);
  const [popperElement, setPopperElement] = useState(null);
  const [arrowElement, setArrowElement] = useState(null);
  const { styles, attributes } = usePopper(referenceElement, popperElement, {
    modifiers: [{ name: 'arrow', options: { element: arrowElement } }],
  });

  return (
    <>
      <button type="button" ref={setReferenceElement}>
        Reference element
      </button>

      <div ref={setPopperElement} style={styles.popper} {...attributes.popper}>
        Popper element
        <div ref={setArrowElement} style={styles.arrow} />
      </div>
    </>
  );
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: removes all item occurrences in array 
Javascript :: Backbone Initialize Arguments 
Javascript :: nodejs express parse query params boolean 
Javascript :: advanced javascript 
Javascript :: how to use graph api with react native 
Javascript :: freecodecamp using props to render conditionally 
Javascript :: how to create element with class in javascript 
Javascript :: _.isEqual Underscore Example 
Javascript :: javascript destructure multiple levels 
Javascript :: new date is not working in react js 
Javascript :: Simplest Template Example 
Javascript :: react native uncaught error main has not been registered stackoverflow 
Javascript :: hsv to rgb js 
Javascript :: react native leaflet 
Javascript :: $() in javascript 
Javascript :: context 
Javascript :: react createelement data attribute 
Javascript :: highest value of x and y in javascript 
Javascript :: react leaflet layer disable controls while on top 
Javascript :: loading indicator react native 
Javascript :: form submit with ajax 
Javascript :: create type in javascript 
Javascript :: set timeout with no name 
Javascript :: javascript declaring variables 
Javascript :: node js orderby method 
Javascript :: How to display html link inside table cell using reactjs material-table 
Javascript :: create index with multiple fields mongo 
Javascript :: javascript Vue Component Loading Before Vuex Data Is Set 
Javascript :: How to append variable with anchor element href link in Angularjs 
Javascript :: How can I save a option from multi select in Angular 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =