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.
An Actions Menu built using an OdsButton and OdsMenu.
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.
Buttons are used for interface actions. Primary style should be used only once per section for main call-to-action, while other styles can appear more frequently.
Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.
Menus provide a list of options for the user to choose from.
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.
This component is still in development and cannot be imported at this time.
| Name | Description |
|---|---|
| (default) | The popover's main content. |
| trigger | The popover's trigger, usually a `<ods-button>` element. |
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/Attribute | Reflects | Type | Default |
|---|---|---|---|
open | boolean | false | |
arrow | boolean | false | |
placement | | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end' | 'bottom-start' | |
disabled | boolean | false | |
stayOpenOnSelect | boolean | false | |
distance | number | 8 | |
skidding | number | 0 | |
hoist | boolean | false | |
sync | 'width' | 'height' | 'both' | undefined | undefined |
| React Event | Description | Event Detail |
|---|---|---|
| ods-show | Emitted when the popover opens. | -- |
| ods-after-show | Emitted after the popover opens and all animations are complete. | -- |
| ods-hide | Emitted when the popover closes. | -- |
| ods-after-hide | Emitted after the popover closes and all animations are complete. | -- |
| Name | Description | Arguments |
|---|---|---|
| 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. | -- |
| Name | Description |
|---|---|
| base | The component's base wrapper. |
| trigger | The container that wraps the trigger. |
| panel | The panel that gets shown when the popover is open. |
This component automatically imports the following dependencies.