Popover¶
A popover is a temporary overlay that displays above other content when users activate a trigger element.
Usage¶
Popovers are used for brief, contextual information or temporary functionality that requires little screen space. They appear when users select a specific control or interactive area and automatically close when users select outside of them or complete an action within the popover.
When to use¶
- To provide short, contextual information or additional functionality related to a control.
- For temporary content that doesn’t require a full page or modal view.
- To provide contextual help, guiding users with explanations or assistance specific to their current task.
Best practices¶
- Limit functionality to a few related tasks or brief information.
- Avoid placing critical actions or decisions within a popover.
- Display only one popover at a time.
- Popovers should be just large enough to accommodate their content.
Design¶
Elements¶
- Container, 2. Title (optional), 3. Body content, 4. Tip
Placement¶
Four position options are available: top, end, bottom and start. Besides that, auto option may be used to detect a position that fits the component on the screen. They should not cover too much of the screen or obscure important content.
Content¶
Popovers can include text, links, buttons, and other interactive elements relevant to the task at hand.
Tooltips vs. popovers¶
Tooltips are meant for supplementary, non-essential information. They’re limited to brief, non-interactive text and appear on hover, making them inaccessible on touch devices.
Popovers provide more comprehensive contextual information or functionality. They open upon user selection.
Component | Tooltip | Popover |
---|---|---|
Purpose | Provides supplementary, non-essential information. | Displays contextual information or interactive elements. |
Interaction | Appears on hover. | Opens on selection. |
Dismissal | Disappears when the cursor moves away. | Requires user interaction to close. |
Interactivity | Non-interactive, only displays text. | Can contain buttons, links, and inputs. |
Code¶
Usage¶
Use siPopover
directive to display the popover.
import { SiPopoverDirective } from '@siemens/element-ng/popover';
@Component({
imports: [SiPopoverDirective, ...]
})
Basic usage and positioning¶
SiPopoverDirective API Documentation¶
[siPopover]
si-popover
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
containerClass ¶ | string | '' | The class that will be applied to container of the popover |
icon ¶ | string | The icon to be displayed besides popover title | |
isOpen ¶ | (undefined | boolean ) | false | Specify whether or not the popover is currently shown |
outsideClick ¶ | boolean | true | The flag determines whether to close popover on clicking outside |
placement ¶ | ("end" | "start" | "top" | "bottom" | "auto" ) | 'auto' | The placement of the popover. One of 'top', 'start', end', 'bottom' |
popoverContext ¶ | unknown | The context for the attached template | |
popoverTitle ¶ | string | '' | The title to be displayed on top for the popover |
siPopover ¶ | (string | TemplateRef <any >) | The popover text to be displayed | |
triggers ¶ | string | 'click' | The trigger event(s) on which the popover shall be displayed. Applications can pass multiple triggers separated by space. Supported events are 'click', 'hover' and 'focus'. Limitations: Safari browsers do not raise a 'focus' event on host element click and 'focus' on tab key has to be enabled in the advanced browser settings. |
Output Properties¶
Name | Type | Description |
---|---|---|
void | Emits an event when the popover is hidden | |
shown ¶ | void | Emits an event when the popover is shown |
Attributes and Methods¶
Name | Type | Default | Description |
---|---|---|---|
hide() ¶ | () => void | Hides the popover and emits 'hidden' event. | |
(readonly) placementInternal ¶ | Signal <("end" | "start" | "top" | "bottom" | "auto" )> | ... | |
show() ¶ | () => void | Displays popover and emits 'shown' event. | |
updatePosition() ¶ | () => void | Updates the position of the popover based on the position strategy. |
Types Documentation¶
No types to document for items on this page.
Code (next)¶
The popover will be re-written to enhance its functionality. It will replace the existing popover as part of Element v48. In the meantime, every element related to the new si-popover
will have a -next
suffix. With the si-popover-next
, accessibility will be improved through better compatibility with tools like screen readers and standardized focus management, while its behavior will see some changes: the inputs triggers
, outsideClick
and isOpen
will no longer be supported because the popover will open only on click or selection, it will always close on an outside click, and the open state will be managed internally.
Usage (next)¶
Use the siPopover
directive to display the popover.
import {
SiPopoverNextDirective,
SiPopoverTitleDirective,
SiPopoverDescriptionDirective
} from '@siemens/element-ng/popover-next';
@Component({
imports: [SiPopoverNextDirective, SiPopoverTitleDirective, SiPopoverDescriptionDirective ...]
})
Basic usage and positioning (next)¶
SiPopoverNextDirective API Documentation¶
[siPopoverNext]
si-popover-next
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
containerClass ¶ | string | '' | The class that will be applied to container of the popover |
icon ¶ | string | The icon to be displayed besides popover title | |
placement ¶ | ("end" | "start" | "top" | "bottom" | "auto" ) | 'auto' | The placement of the popover. One of 'top', 'start', end', 'bottom' |
popoverContext ¶ | unknown | The context for the attached template | |
popoverTitle ¶ | string | The title to be displayed on top for the popover | |
siPopoverNext ¶ | (string | TemplateRef <unknown >) | The popover text to be displayed |
Output Properties¶
Name | Type | Description |
---|---|---|
visibilityChange ¶ | void | Emits an event when the popover is shown/hidden |
Attributes and Methods¶
Name | Type | Default | Description |
---|---|---|---|
hide() ¶ | () => void | Hides the popover and emits 'hidden' event. | |
(readonly) placementInternal ¶ | Signal <("end" | "start" | "top" | "bottom" | "auto" )> | ... | |
(readonly) popoverCounter ¶ | number | ... | |
(readonly) popoverId ¶ | string | ... | |
show() ¶ | () => void | Displays popover and emits 'shown' event. | |
updatePosition() ¶ | () => void | Updates the position of the popover based on the position strategy. |
Except where otherwise noted, content on this site is licensed under MIT License.