Popover

维护者:
amje
GitHub
hasArrow
disabled
trigger
placement
import {Popover} from '@gravity-ui/uikit';

The Popover component is technically the Popup with some trigger interactivity built-in. The Popover uses passed ReactElement from children property as a trigger, and opens whenever trigger is hovered or clicked. Content of the Popover might contain interactive elements like links or buttons.

Usage

Wrap HTML element or any component that accepts native DOM handlers and ARIA attributes in properties (i.e. Button) with Popover component. Put your content into content property.

import {Button, Popover} from '@gravity-ui/uikit';

<Popover content="Content">
  <Button>Click or hover me</Button>
</Popover>;

Properties

NameDescriptionTypeDefault
childrenReactNode which accepts DOM handlersReact.ReactNode
classNameHTML class attribute for root nodestring
containerDOM element to which component is mounted via PortalHTMLElementdocument.body
contentAny content to render inside the PopoverReact.ReactNode
contentClassNameHTML class attribute for content nodestring
delayWait specified time in milliseconds before changing open statenumber {open?: number; close?: number}
disableEscapeKeyDownDo not dismiss on Esc keydownbooleanfalse
disableLayerDo not use LayerManager on stacking floating elementsbooleanfalse
disableOutsideClickDo not dismiss on outside clickbooleanfalse
disablePortalDisables using Portalbooleanfalse
disabledDo not open on any eventbooleanfalse
enableSafePolygonUse dynamic polygon area when moving the pointer from trigger to Popover content to prevent it from closingbooleanfalse
hasArrowRender an arrow pointing to the triggerbooleanfalse
keepMountedPopover will not be removed from the DOM upon hidingbooleanfalse
middlewaresFloating UI middlewares. If set, they will completely overwrite the default middlewares.Array<Middleware>
modalEnables focus trapping behaviourbooleanfalse
offsetFloating UI offset valuePopoverOffset4
onOpenChangeFunction that is called when the open state changesFunction
openManually control the open stateboolean
placementFloating UI placementPlacement Array<Placement> "auto" "auto-start" "auto-end""top"
qaTest attribute (data-qa)string
strategyFloating UI positioning strategy"absolute" "fixed""absolute"
styleHTML style attribute for root nodestring
triggerWhich event should open the Popover. By default, click and hover both do"click"