Popover

A Popover can be used to create UI Patterns that show content in overlays above other content. A trigger element (Button, Icon Button) is used to display the contents you want to display.

An Popover showing custom content built using an OdsIconButton and custom content.

Showing some popover content

An Actions Menu built using an OdsButton and OdsMenu.

Save Edit Delete

A Calendar Presets Menu configured using OdsPopover, OdsButton and OdsMenu. When the menu item is selected, the label on the OdsButton is updated with the value defined in the menu item.

This week
import '@ods/components/web.popover';

Note: You only need to import a web component once in your code, as it registers itself globally when defined, allowing you to use it anywhere within your application without needing to re-import it each time you want to use the component.

Slots

NameDescription
(default)The popover's main content.
triggerThe popover's trigger, usually a `<ods-button>` element.

Properties

Please note, both DOM properties and HTML attributes are shown in the table below. Unless otherwise specified, the property and attribute names are identical.

Property/AttributeReflectsTypeDefault
open
booleanfalse
arrow
booleanfalse
placement
| 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end''bottom-start'
disabled
booleanfalse
stayOpenOnSelect
stay-open-on-select
booleanfalse
distance
number8
skidding
number0
hoist
booleanfalse
sync
'width' | 'height' | 'both' | undefinedundefined

Events

React EventDescriptionEvent Detail
ods-showEmitted when the popover opens.--
ods-after-showEmitted after the popover opens and all animations are complete.--
ods-hideEmitted when the popover closes.--
ods-after-hideEmitted after the popover closes and all animations are complete.--

Methods

NameDescriptionArguments
show()Shows the popover panel.--
hide()Hides the popover panel--
reposition()Instructs the popover menu to reposition. Useful when the position or size of the trigger changes when the menu is activated.--

Parts

NameDescription
baseThe component's base wrapper.
triggerThe container that wraps the trigger.
panelThe panel that gets shown when the popover is open.

Dependencies

This component automatically imports the following dependencies.

  • ods-popup

Search