Popper
Usage
Popper is a utility component used under the hood in Menu, Popover, Tooltip and other Mantine components. You can use it to create your own dropdowns and popovers if Mantine components do not meet your requirements.
To use Popper, add the following required props first:
referenceElement
– element based on which popper will be positionedchildren
– popper content, any React nodemounted
– current popper opened state: true to display, false to hide
Position
Popper position is controlled by these props:
position
– left, right, bottom, topplacement
– start, center, endgutter
– spacing between reference and dropdown elements in pxwithArrow
– displays arrow, arrow position is calculated byposition
andplacement
propsarrowSize
– arrow size in px
Transitions
Popper uses Transition component to animate presence. You can choose one of the premade transitions or create your own. All premade transitions demo (Tooltip component which uses Popper):
You can control Popper transition with the following props:
transition
– premade transition name or custom transition styles objecttransitionDuration
– transition duration in ms, defaults to 0transitionTimingFunction
– defaults totheme.transitionTimingFunction
Force position update
In some cases Popper position will get outdated since it is rendered in Portal Popper does not know about layout changes. To force position update, provide an array of dependencies which trigger layout updates:
z-index
By default, Popper has z-index: 1
, you can change that with zIndex
prop: