Popover overview

Overview
API
Theme
Examples

NbPopoverDirective

Powerful popover directive, which provides the best UX for your users.

Showcase

Popover can accept different content such as: TemplateRef

<button [nbPopover]="templateRef"></button>
<ng-template #templateRef>
  <span>Hello, Popover!</span>
</ng-template>

Installation

Import NbPopoverModule to your feature module.

@NgModule({
  imports: [
    // ...
    NbPopoverModule,
  ],
})
export class PageModule { }

Usage

Custom components

<button [nbPopover]="MyPopoverComponent"></button>

Both custom components and templateRef popovers can receive contentContext property that will be passed to the content props.

Primitive types

<button nbPopover="Hello, Popover!"></button>

Popover has different placements, such as: top, bottom, left, right, start and end which can be used as following:

Placements

By default popover will try to adjust itself to maximally fit viewport and provide the best user experience. It will try to change position of the popover container. If you want to disable this behaviour set it noop.

<button nbPopover="Hello, Popover!" nbPopoverAdjustment="noop"></button>

Popover has a number of triggers which provides an ability to show and hide the component in different ways:

  • Click mode shows the component when a user clicks on the host element and hides when the user clicks somewhere on the document outside the component.
  • Hint provides capability to show the component when the user hovers over the host element and hide when the user hovers out of the host.
  • Hover works like hint mode with one exception - when the user moves mouse from host element to the container element the component remains open, so that it is possible to interact with it content.
  • Focus mode is applied when user focuses the element.
  • Noop mode - the component won't react to the user interaction.
Available Triggers

Noop mode is especially useful when you need to control Popover programmatically, for example show/hide as a result of some third-party action, like HTTP request or validation check:

Manual Control

Below are examples for manual popover settings control, both via template binding and code.

Popover Settings

Please note, while manipulating Popover setting via code, you need to call rebuild() method to apply the settings changed.

Popover Settings Code

NbPopoverComponent

Overlay container. Renders provided content inside.

Tag
Previous page
Context Menu
Next page

Need some help or found an issue?

Ask on Stack Overflow with tag `nebular` or post an issue on GitHub.