Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example of using arrow in Popper component of material-ui

There is playground example on Popper component page of material-ui. To add arrow they use arrowRef. Please explain me where do they get it from?

like image 694
DmitriyBelovol Avatar asked Aug 14 '19 18:08

DmitriyBelovol


People also ask

How do you put an arrow in a material UI Popper?

There is playground example on Popper component page of material-ui. To add arrow they use arrowRef.

Does material UI use popper?

Material UI for React has this component available for us, and it is simple and very easy to integrate. For perfect positioning, it uses 3rd party library which is Popper.

What is a popper component?

A Popper can be used to display some content on top of another. It's an alternative to react-popper. Some important features of the Popper component: 🕷 Popper relies on the 3rd party library (Popper.js) for perfect positioning. 💄 It's an alternative API to react-popper.

How do you make a popover component in react?

Step 1: Create a React application using the following command. Step 2: After creating your project folder i.e. foldername, move to it using the following command. Step 3: After creating the ReactJS application, Install the material-ui modules using the following command.


2 Answers

You can find the source code of the Material UI Popper "Scroll Playgroud" example here: https://github.com/mui-org/material-ui/blob/4f2a07e140c954b478a6670c009c23a59ec3e2d4/docs/src/pages/components/popper/ScrollPlayground.js

As you can see, there is some extra styling that you will need to add to your app to display the arrow correctly, because it's not included in the Material UI library itself.

like image 183
Mike Avatar answered Sep 28 '22 22:09

Mike


For others looking for a concrete, reusable component that is simple to use like Tooltip but has a more interactive nature like Popper or Popover you can lift and shift the RichTooltip component from the following sandbox I created - it's typescript too. Hope this helps the next person and hides the complexity of arrows for you.

https://codesandbox.io/s/popper-with-arrow-58jhe

like image 37
Matt Byrne Avatar answered Sep 28 '22 22:09

Matt Byrne