跳转到内容

Popover 弹出框

弹出框可用于在元素边缘显示某些内容。

使用 Popover 组件时需要了解的事项:

  • The component is built on top of the Modal component.
  • The scroll and click away are blocked unlike with the Popper component.

简单的弹出窗口

锚点播放场

使用单选按钮调整 anchorOrigintransformOrigin 位置。 您还可以将 anchorReference 设置为 anchorPositionanchorEl。 当它是 anchorPosition,该组件将代替 anchorEl, 指的是 anchorPosition 道具,其可以调整设置 的酥料饼的位置。

anchorReference
 
anchorOrigin.vertical
transformOrigin.vertical
anchorOrigin.horizontal
transformOrigin.horizontal

<Popover 
  anchorOrigin={{
    vertical: 'top',
    horizontal: 'left',
  }}
  transformOrigin={{
    vertical: 'top',
    horizontal: 'left',
  }}
>
  The content of the Popover.
</Popover>

鼠标悬停在互动上

This demonstrates how to use the Popover component to implement a popover behavior based on the mouse over event.

Hover with a Popover.

补充项目

对于更高级的用例,您可以利用:

PopupState helper

在大多数情况下,一个第三方包 material-ui-popup-state 可以为你处理popper 的 state 。