Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@terminus/ui-popover

GetTerminus9MIT3.1.1TypeScript support: included

Popover

readme

Popover

CI/CD Status Codecov MIT License
NPM version Library size

Popover component is designed to pop up simple or complex content based on a user trigger.

Table of Contents

Installation

Use the ng add command to quickly install all the needed dependencies:

ng add @terminus/ui-popover

CSS imports

In your top-level stylesheet, add these imports:

@import '~@terminus/design-tokens/css/library-design-tokens.css';
@import '~@terminus/ui-styles/terminus-ui.css';

CSS resources

Load the needed font families by adding this link to the <head> of your application:

<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">

popper.js

This popover component is built on top of a 3rd party library called popper.js.

popper.js can be installed by running: yarn add @popperjs/core

popper.js documentation

Usage

Define a popover trigger and popover content:

<button [tsPopoverTrigger]="myPopper">Click me!</button>

<ts-popover #myPopper>
  <h1>My Title</h1>
  <p>Any HTML can be placed here!</p>
</ts-popover>

Position

Defines where the popover is positioned relative to current element:

<button
  [tsPopoverTrigger]="myPopper"
  [position]="top"
>Click me!</button>

<ts-popover #myPopper>My popover</ts-popover>

The default is bottom. For all available positions, please see the popper.js placement docs.

Popover trigger

Popover supports two types of trigger, click and hover.

<button
  [tsPopoverTrigger]="myPopper"
  popoverTrigger="click"
>Click me!</button>

<ts-popover #myPopper>My popover</ts-popover>

The default is click.

Hide on blur

By default, the popover will be closed by clicking outside the popover. If this is not desired, it can be disabled:

<button
  [tsPopoverTrigger]="myPopper"
  [hideOnBlur]="false"
>Click me!</button>

<ts-popover #myPopper>My popover</ts-popover>

It defaults to true.

Open on load

The popover can be defined to open on load:

<button
  [tsPopoverTrigger]="myPopper"
  [defaultOpened]="true"
>Click me!</button>

<ts-popover #myPopper>My popover</ts-popover>

It defaults to false.

Events

Event Description Payload
popoverOnShown Fired when popover shows up popoverInstance
popoverOnHidden Fired when popover hides popoverInstance

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.1.1 (2021-03-03)

Bug Fixes

  • Popover: add missed position, remove positions duplicates. (#552) (3608239)

3.1.0 (2021-01-19)

Features

  • Popover: refactor to only require one instance passed in (1566bad), closes #530

3.0.1 (2021-01-12)

Note: Version bump only for package @terminus/ui-popover

3.0.0 (2020-12-16)

Bug Fixes

  • Button: background now has correct transition (38f4afd)
  • Popover: upgrade to NG11 & TS4 (2321e5f)

BREAKING CHANGES

  • Popover: Now requires NG11+ and TS4+

2.2.5 (2020-11-11)

Bug Fixes

  • Popover: add ui-styles to schematic (1a97ff3)

2.2.4 (2020-11-11)

Bug Fixes

  • Popover: correct dependencies, move stories (402f4a5)

2.2.3 (2020-10-05)

Note: Version bump only for package @terminus/ui-popover

2.2.2 (2020-09-14)

Note: Version bump only for package @terminus/ui-popover

2.2.1 (2020-09-11)

Note: Version bump only for package @terminus/ui-popover

2.2.0 (2020-09-08)

Bug Fixes

  • force material & cdk ^9.2.4 for consumers (ea09a6f), closes #275

Features

2.1.9 (2020-09-04)

Note: Version bump only for package @terminus/ui-popover

2.1.8 (2020-09-03)

Note: Version bump only for package @terminus/ui-popover

2.1.7 (2020-08-26)

Note: Version bump only for package @terminus/ui-popover

2.1.6 (2020-08-25)

Note: Version bump only for package @terminus/ui-popover

2.1.5 (2020-08-21)

Note: Version bump only for package @terminus/ui-popover

2.1.4 (2020-08-14)

Note: Version bump only for package @terminus/ui-popover

2.1.3 (2020-08-10)

Note: Version bump only for package @terminus/ui-popover

2.1.2 (2020-08-10)

Note: Version bump only for package @terminus/ui-popover

2.1.1 (2020-08-10)

Note: Version bump only for package @terminus/ui-popover

2.1.0 (2020-08-06)

Features

  • Popover: Support hover trigger (4d1743b)

2.0.4 (2020-07-31)

Note: Version bump only for package @terminus/ui-popover

2.0.3 (2020-07-29)

Note: Version bump only for package @terminus/ui-popover

2.0.2 (2020-07-28)

Note: Version bump only for package @terminus/ui-popover

2.0.1 (2020-07-28)

Bug Fixes

  • bump all package versions (9446c0d)

2.0.0 (2020-07-27)

Bug Fixes

  • Popover: update border radius (8faa99d)

BREAKING CHANGES

  • Popover: Border radius change

2.0.0 Migration Notes

CSS Resources

Remove any imports or <link> tags importing Material Icons:

-<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Update the imported font families:

-<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
+<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">

1.0.7 (2020-07-13)

Note: Version bump only for package @terminus/ui-popover

1.0.6 (2020-07-13)

Bug Fixes

  • ESLintConfig: add build command (b38ada9)
  • Popover: use css properties (ac2707c), closes #120

1.0.5 (2020-07-07)

Note: Version bump only for package @terminus/ui-popover

1.0.4 (2020-06-23)

Note: Version bump only for package @terminus/ui-popover

1.0.3 (2020-06-10)

Bug Fixes

  • bump all internal dependencies (ff26b80)

1.0.2 (2020-06-09)

Bug Fixes