Skip to main content
Neural UIv2.1.0Documentation
View v1

Popover

Show contextual information beside a trigger with text or a template.

Category
Overlays
Import
@neural-ui/core/popover
Selector
[neuPopover]
import { NeuPopoverDirective } from '@neural-ui/core/popover';

Overview

Bind a template to neuPopover for formatted content. For plain text, use the neuPopover selector on the host and bind neuPopoverText. The click mode works with a native button and supports touch, mouse and keyboard activation.

Try it

Open the shipping information to read the delivery estimate beside the button. Unlike the short text-only Tooltip, this popover renders a formatted template. neuPopoverContext supplies the estimate and the output reports whether it is open.

Try it
Closed

State and events

Opening and closing events report visibility. Use open(), close() or toggle() on the neuPopover template reference for imperative interactions. The template and its context belong to the application.

Accessibility and keyboard

Use a labelled native button for click mode. The click popover uses a non-modal dialog role. Reserve hover and focus for supplemental content; use Dialog for a task that needs modal focus management.

Key
Action
Tab Focus the trigger. In focus mode, the popover opens on focus.
Enter / Space Activate a native button in click mode.
Escape Dismiss an open popover.

API

Import the directive from its public entry point and attach it to a host element.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
neuPopoverTemplateRef<unknown> | nullnull[neuPopover]Template to render in the popover. Takes precedence over plain text.
neuPopoverContextunknown{}[neuPopoverContext]Context passed to the supplied template.
neuPopoverDisabledbooleanfalse[neuPopoverDisabled]Suppress opening while true.
neuPopoverPositionNeuPopoverPosition'bottom'[neuPopoverPosition]Preferred side of the trigger.
neuPopoverTextstring''[neuPopoverText]Plain text used when no template is supplied.
neuPopoverTriggerNeuPopoverTrigger'click'[neuPopoverTrigger]Select click, hover or focus as the opening interaction.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
popoverClosedvoid(popoverClosed)="onPopoverClosed($event)"Emits after the popover closes.
popoverOpenedvoid(popoverOpened)="onPopoverOpened($event)"Emits when the popover opens.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
neuPopover TemplateRef inputTemplateRef<unknown> | null

Usage example

Content between the button tags is projected content. You can supply text, an icon component or an SVG; the Icons section demonstrates these variants. For iconOnly, omit visible text and provide ariaLabel: projected content is not automatically removed.

Customize content
Closed

Public methods

Name
Contract
closeclose(): void;
openopen(): void;
toggletoggle(): void;

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Apply the Neural theme to the application and check the overlay in both color schemes before overriding any public tokens.

Specific tokens

Token
Purpose
State / variant
Default / source
Fallback
--neu-popover-bg Inherited theme value used by this component Field surface var(--neu-surface)Root declaration--neu-surface
--neu-popover-border Inherited theme value used by this component Field surface var(--neu-border)Root declaration--neu-border
--neu-popover-color Inherited theme value used by this component Field surface var(--neu-text-primary)Root declaration--neu-text-primary
--neu-popover-max-width Inherited theme value used by this component Field surface 320pxRoot declarationNo token alias
--neu-popover-min-width Inherited theme value used by this component Field surface 200pxRoot declarationNo token alias
--neu-popover-padding Inherited theme value used by this component Field surface var(--neu-space-3) var(--neu-space-4)Root declaration--neu-space-3, --neu-space-4
--neu-popover-radius Corner radius Field surface var(--neu-radius-lg)Root declaration--neu-radius-lg
--neu-popover-shadow Surface or overlay elevation Field surface var(--neu-shadow-lg)Root declaration--neu-shadow-lg

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-text Main text and inherited icon color Shared by other Core consumers; scope the override. #0f172a
--neu-border-color Inherited theme value used by this component Shared by other Core consumers; scope the override. var(--neu-border)
--neu-radius-lg Corner radius Shared by other Core consumers; scope the override. 12px
--neu-surface-1 Inherited theme value used by this component Shared by other Core consumers; scope the override. var(--neu-surface)
--neu-text-primary Inherited theme value used by this component Shared by other Core consumers; scope the override. var(--neu-text)