npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-popperjs

v16.0.2

Published

ngx-popper is an Angular wrapper for @popperjs

Downloads

915

Readme

ngx-popperjs

npm npm MIT licensed Build state Size Rate this package

ngx-popperjs is an angular wrapper for the Popper.js library.

Note that I also updated everything to use Popper 2 (v 2.4.4 in v 9.0.0)

VERY IMPORTANT READ THIS

I'm moving this to the top because it appears that people don't get to reading it in the contribute section. FOR THIS LIBRARY PLEASE USE ISSUES ONLY FOR BUG REPORTING. DON'T OPEN ISSUES SUCH AS "I need upgrade for Angular 1745646456" especially if Angular 1745646456 was released a few days ago. I guarantee that I manage the updates AS SOON AS POSSIBLE. But as you understand this is not a paying job, so you can't get Angular 1745646456 the day it gets released. ISSUES NOT RESPECTING THIS WILL BE DELETED IMMEDIATELY WITHOUT ANY RESPONSE. Thank you.

The goal of this library is to take Mr Frankel's ngx-popper and update the compatibility for more recent versions of Angular. Since the old library is compatible with Angular 7 and earlier, I started with Angular 8. If you need to work with an older version of Angular (5 to 7), please refer to Mr Frankel's ngx-popper.

Premise, new in v 15.2.0: popperLoose

Since many complained about using the NgxPopperjsPlacements enum, I added a version of the popper directive which accepts a plain string as placement! Now you can use it with all the options of the classic popper, but you'll have to use:

popperLoose instead of popper

and

popperLoosePlacement instead of popperPlacement

Installation

node and npm are required to run this package.

  1. Use npm/yarn to install the package:
$ npm install @popperjs/core ngx-popperjs --save

Or

 $ yarn add @popperjs/core --save
 $ yarn add ngx-popperjs --save 
  1. You simply add into your module NgxPopperjsModule:
import {NgxPopperjsModule} from 'ngx-popperjs';

@NgModule({
 // ...
 imports: [
   // ...
   NgxPopperjsModule
 ]
})

Optionally you can include in your styles.css / styles.css one of the prebuilt themes:

  • @import node_modules/ngx-popperjs/css/theme-dark.css

  • @import node_modules/css/theme-white.css

  • @use ngx-popperjs/scss/theme as popperBaseTheme

  • @use ngx-popperjs/scss/theme-dark as popperDarkTheme

  • @use ngx-popperjs/scss/theme-white popperWhiteTheme

or easily create your own theme using the @mixin:

@use "ngx-popperjs/scss/theme" as popperBaseTheme;

body {
    @include popperjs.ngx-popperjs-theme($background-color, $text-color, $max-width, $z-index);
}
  1. Add to view:
 <popper-content #popper1Content>
     <p class="bold">Popper on bottom</p>
 </popper-content>
 <div [popper]="popper1Content"
      [popperShowOnStart]="true"
      [popperTrigger]="'click'"
      [popperHideOnClickOutside]="true"
      [popperHideOnScroll]="true"
      [popperPlacement]="'bottom'">
     <p class="bold">Hey!</p>
     <p class="thin">Choose where to put your popper!</p>         
 </div>
  1. As text:
     <div popper="As text"
          [popperTrigger]="'hover'"
          [popperPlacement]="'bottom'"
          (popperOnShown)="onShown($event)">
       <p class="bold">Pop</p>
       <p class="thin">on the bottom</p>
     </div>
     <div popper="{{someTextProperty}}"
          [popperTrigger]="'hover'"
          [popperPlacement]="'bottom'"
          [popperStyles]="{'background-color: 'blue''}",
          (popperOnShown)="onShown($event)">
       <p class="bold">Pop</p>
       <p class="thin">on the bottom</p>
     </div>
  1. Position fixed, breaking overflow:
     <div popper="As text"
          [popperTrigger]="'hover'"
          [popperPlacement]="'bottom'"
          [popperPositionFixed]="true"
          (popperOnShown)="onShown($event)">
     </div>
  1. Specific target:
<div class="example">
     <div #popperTargetElement></div>
     <div popper="As text"
          popperTrigger="hover"
          popperPlacement="bottom"
          [popperTarget]="popperTargetElement.nativeElement"
          (popperOnShown)="onShown($event)">
     </div>
  1. hide/show programmatically:
 <div [popper]="tooltipcontent"
      popperTrigger="hover"
      popperPlacement="bottom"
      [popperApplyClass]="'popperSpecialStyle'">
      <p class="bold">Pop</p>
      <p class="thin">on the bottom</p>
    </div>
    <popper-content #tooltipcontent>
      <div>
        <p>This is a tooltip with text</p>
        <span (click)="tooltipcontent.hide()">Close</span>
      </div>
    </popper-content>
  1. Attributes map:

    | Option | Type | Default | Description | |:----------------------- |:---------------- |:--------- | :------------------------------------------------------------------------------------------------------ | | popperDisableAnimation | boolean | false | Disable the default animation on show/hide | | popperDisableStyle | boolean | false | Disable the default styling | | popperDisabled | boolean | false | Disable the popper, ignore all events | | popperDelay | number | 0 | Delay time until popper it shown | | popperTimeout | number | 0 | Set delay before the popper is hidden | | popperTimeoutAfterShow | number | 0 | Set a time on which the popper will be hidden after it is shown | | popperPlacement | Placement(string) | auto | The placement to show the popper relative to the reference element | | popperTarget | HtmlElement | auto | Specify a different reference element other the the one hosting the directive | | popperBoundaries | string(selector) | undefined | Specify a selector to serve as the boundaries of the element | | popperShowOnStart | boolean | false | Popper default to show | | popperTrigger | Trigger(string) | click | Trigger/Event on which to show/hide the popper | | popperPositionFixed | boolean | false | Set the popper element to use position: fixed | | popperAppendTo | string | undefined | append The popper-content element to a given selector, if multiple will apply to first | | popperPreventOverflow | boolean | undefined | Prevent the popper from being positioned outside the boundary | | popperHideOnClickOutside | boolean | true | Popper will hide on a click outside | | popperHideOnScroll | boolean | false | Popper will hide on scroll | | popperHideOnMouseLeave | boolean | false | Popper will hide on mouse leave | | popperModifiers | popperModifier | undefined | popper.js custom modifiers hock | | popperApplyClass | string | undefined | list of comma separated class to apply on ngpx__container | | popperStyles | Object | undefined | Apply the styles object, aligned with ngStyles | | popperApplyArrowClass | string | undefined | list of comma separated class to apply on ngpx__arrow | | popperOnShown | EventEmitter<> | $event | Event handler when popper is shown | | popperOnHidden | EventEmitter<> | $event | Event handler when popper is hidden | | popperOnUpdate | EventEmitter<> | $event | Event handler when popper is updated | | popperAriaDescribeBy | string | undefined | Define value for aria-describeby attribute | | popperAriaRole | string | popper | Define value for aria-role attribute |

  2. Override defaults:

    ngx-popperjs comes with a few default properties you can override in default to effect all instances These are overridden by any child attributes.

NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    NgxPopperjsModule.forRoot({placement: NgxPopperjsPlacements.TOP})],
  declarations: [AppComponent],
  providers: [],
  bootstrap: [AppComponent]

});

| Options | Type | Default | |:------------------- |:---------------- |:--------- | | showDelay               | number           | 0       | | disableAnimation | boolean | false | | disableDefaultStyling | boolean | false | | placement | Placement(string) | auto | | boundariesElement | string(selector) | undefined | | trigger | Trigger(string) | hover | | popperModifiers | popperModifier | undefined | | positionFixed | boolean | false | | hideOnClickOutside | boolean | true | | hideOnMouseLeave | boolean | false | | hideOnScroll | boolean | false | | applyClass | string | undefined | | styles | Object | undefined | | applyArrowClass | string | undefined | | ariaDescribeBy | string | undefined | | ariaRole | string | undefined | | appendTo | string | undefined | | preventOverflow | boolean | undefined |

  1. popperPlacement:

| 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'bottom-start' | 'left-start' | 'right-start' | 'top-end' | 'bottom-end' | 'left-end' | 'right-end' | 'auto' | 'auto-start' | 'auto-end' | Function

  1. popperTrigger:

| 'click' | 'mousedown' | 'hover' | 'none'

Demo site with sample codes

Demo of ngx-popperjs

Contribute

You can only report bugs. Every other issue will be deleted right away.

  $ npm install
  $ npm run start  //run example

Special thanks

Jetbrains is now supporting this library with an open-source license, which will allow a better code! 🎉

jetbrains-logo

License

This project is licensed under the MIT License - see the LICENSE file for details

Thanks to

MrFrankel for setting up ngx-popper and maintaining till v 7.0.0.