All Projects β†’ ngneat β†’ Helipopper

ngneat / Helipopper

Licence: mit
🚁 A Powerful Tooltip and Popover for Angular Applications

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Helipopper

React Layer Stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 152 (-29.3%)
Mutual labels:  tooltip, popover
Ember Tooltips
Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/
Stars: ✭ 205 (-4.65%)
Mutual labels:  tooltip, popover
Popper Core
🍿 JavaScript positioning library for tooltips, popovers, dropdowns, and more
Stars: ✭ 18,903 (+8692.09%)
Mutual labels:  tooltip, popover
react-popover
Customizable positioning for tooltips, menus, and any other DOM elements inside of a container
Stars: ✭ 13 (-93.95%)
Mutual labels:  popover, tooltip
Tippyjs
Tooltip, popover, dropdown, and menu library
Stars: ✭ 9,433 (+4287.44%)
Mutual labels:  tooltip, popover
Bootstrap-Confirmation
Bootstrap plugin for on-place confirm boxes using Popover
Stars: ✭ 303 (+40.93%)
Mutual labels:  popover, tooltip
React Laag
Hooks to build things like tooltips, dropdown menu's and popovers in React
Stars: ✭ 568 (+164.19%)
Mutual labels:  tooltip, popover
react-native-popable
Popovers, tooltips for React Native
Stars: ✭ 298 (+38.6%)
Mutual labels:  popover, tooltip
Tippyjs React
React component for Tippy.js (official)
Stars: ✭ 1,081 (+402.79%)
Mutual labels:  tooltip, popover
Ng Bootstrap
Angular powered Bootstrap
Stars: ✭ 7,872 (+3561.4%)
Mutual labels:  tooltip, popover
Popover
Angular CDK Popover, no default style, examples using @angular/material
Stars: ✭ 156 (-27.44%)
Mutual labels:  tooltip, popover
React Popper
πŸΏβš›Official React library to use Popper, the positioning library
Stars: ✭ 2,173 (+910.7%)
Mutual labels:  tooltip, popover
react-sticky-mouse-tooltip
React tooltip component that follow mouse cursor.
Stars: ✭ 17 (-92.09%)
Mutual labels:  popover, tooltip
Tooltip Sequence
A simple step by step tooltip helper for any site
Stars: ✭ 287 (+33.49%)
Mutual labels:  tooltip, popover
floating-ui
A low-level toolkit to create floating elements. Tooltips, popovers, dropdowns, and more
Stars: ✭ 23,485 (+10823.26%)
Mutual labels:  popover, tooltip
React Cool Portal
😎 πŸ’ React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (+113.02%)
Mutual labels:  tooltip, popover
toppy
Overlay library for Angular 7+
Stars: ✭ 81 (-62.33%)
Mutual labels:  popover, tooltip
react-layer-stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 158 (-26.51%)
Mutual labels:  popover, tooltip
Sveltejs Tippy
Tippy.js for Svelte
Stars: ✭ 26 (-87.91%)
Mutual labels:  tooltip, popover
Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (-46.51%)
Mutual labels:  tooltip, popover


MIT commitizen PRs styled with prettier All Contributors ngneat spectator @ngneat/helipopper

A Powerful Tooltip and Popover for Angular Applications

Tippy.js is the complete tooltip, popover, dropdown, and menu solution for the web, powered by Popper.js.

It is an abstraction over Popper that provides the logic and optionally the styling involved in all types of elements that pop out from the flow of the document and get overlaid on top of the UI, positioned next to a reference element.

This is a lightweight wrapper with additional features that lets you use it declaratively in Angular. Tippy has virtually no restrictions over Popper and gives you limitless control while providing useful behavior and defaults.

If you're using v1 and don't want to migrate, you can find it here.

Features

βœ… Position Tooltips, Menus, Dropdowns, and Popovers
βœ… Predefined Variations
βœ… TemplateRef/Component Support
βœ… Lazy Registration
βœ… Manual Trigger Support
βœ… Text Overflow Support
βœ… Context Menu Support

Installation

ng add @ngneat/helipopper

It will automatically add the TippyModule to your AppModule. You can configure it as shown below:

import { TippyModule, tooltipVariation, popperVariation } from '@ngneat/helipopper';

@NgModule({
  declarations: [AppComponent],
  imports: [TippyModule.forRoot({
    defaultVariation: 'tooltip',
    variations: {
      tooltip: tooltipVariation,
      popper: popperVariation,
    }
  })],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Add the styles you want to styles.scss:

@import '~tippy.js/dist/tippy.css';
@import '~tippy.js/themes/light.css';
@import '~tippy.js/animations/scale.css';

You have the freedom to customize it if you need to.

Now you can use it in your templates:

<button tippy="Helpful Message">
  I have a tooltip
</button>

The library exposes default variations for tooltip and popper. You can use them, extend them, or pass your own variations. A variation is a set of predefined tippy properties. For example, here's how the built-in tooltip variation looks like:

export const tooltipVariation = {
  theme: null,
  arrow: false,
  animation: 'scale',
  trigger: 'mouseenter',
  offset: [0, 5]
};

Use TemplateRef as content

<button [tippy]="tpl" variation="popper">
  Click Me
</button>

<ng-template #tpl let-hide>
  <h6>Popover title</h6>
  <p>And here's some amazing content. It's very engaging. Right?</p>
</ng-template>

Use Component as content

import { TIPPY_REF, TippyInstance } from '@ngneat/helipopper';

@Component()
class MyComponent {
  constructor(@Inject(TIPPY_REF) tippy: TippyInstance) {
  }
}
<button [tippy]="MyComponent">
  Click Me
</button>

Text Overflow

You can pass the onlyTextOverflow input to show the tooltip only when the host overflows its container:

<div style="max-width: 100px;" class="overflow-hidden flex">
  <p class="ellipsis" [tippy]="text" placement="right" [onlyTextOverflow]="true">
    {{ text }}
  </p>
</div>

Note that it's using ResizeObserver api.

Lazy

You can pass the lazy input when you want to defer the creation of tippy only when the element is in the view:

<div *ngFor="let item of items" 
     [tippy]="item.label" 
     [lazy]="true">{{ item.label }}
</div>

Note that it's using IntersectionObserver api.

Context Menu

First, define the contextMenu variation:

import { 
  popperVariation, 
  TippyModule, 
  tooltipVariation, 
  withContextMenuVariation 
} from '@ngneat/helipopper';

@NgModule({
  imports: [
    TippyModule.forRoot({
      defaultVariation: 'tooltip',
      variations: {
        tooltip: tooltipVariation,
        popper: popperVariation,
        contextMenu: withContextMenuVariation(popperVariation),
      }
    })
  ],
})
export class AppModule {}

Now you can use it in your template:

<ng-template #contextMenu let-hide let-item="data">
  <ul>
    <li (click)="copy(item); hide()">Copy</li>
    <li (click)="duplicate(item); hide()">Duplicate</li>
  </ul>
</ng-template>

<ul>
  <li *ngFor="let item of list" 
      [tippy]="contextMenu" 
      [data]="item" 
      variation="contextMenu">
    {{ item.label }}
  </li>
</ul>

Manual Trigger

<div tippy="Helpful Message" trigger="manual" #tooltip="tippy">
  Click Open to see me
</div>

<button (click)="tooltip.show()">Open</button>
<button (click)="tooltip.hide()">Close</button>

You can see more examples in our playground, or live here.

Inputs

appendTo: TippyProps['appendTo'];
delay: TippyProps['delay'];
duration: TippyProps['duration'];
hideOnClick: TippyProps['hideOnClick'];
interactive: TippyProps['interactive'];
interactiveBorder: TippyProps['interactiveBorder'];
maxWidth: TippyProps['maxWidth'];
offset: TippyProps['offset'];
placement: TippyProps['placement'];
popperOptions: TippyProps['popperOptions'];
showOnCreate: TippyProps['showOnCreate'];
trigger: TippyProps['trigger'];
triggerTarget: TippyProps['triggerTarget'];
zIndex: TippyProps['zIndex'];

lazy: boolean;
variation: string;
isEnable: boolean;
className: string;
onlyTextOverflow: boolean;
useHostWidth: boolean;
data: any;

Outputs

visible = new EventEmitter<boolean>();

Global Config

  • You can pass any tippy option at global config level.
  • beforeRender - Hook that'll be called before rendering the tooltip content ( applies only for string )

Create tippy Programmatically

import { TippyService, TippyInstance } from '@ngneat/helipopper';

class Component {
  @ViewChild('inputName') inputName: ElementRef;
  private tippy: TippyInstance;

  constructor(private tippy: TippyService) {
  }

  open() {
    if(!this.tippy) {
      this.tippy = this.tippy.create(this.inputName, 'this field is required');
    }

    this.tippy.open();
  }

  ngOnDestroy() {
    this.tippy?.destroy();
  }
}

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Netanel Basal

πŸ’» πŸ“– πŸ€”

Itay Oded

πŸ’»

GΓ©rΓ΄me Grignon

πŸ’»

Artur Androsovych

πŸ’» ⚠️

Shahar Kazaz

πŸ’» πŸ“–

stefanoww

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome! Icon made by Airport from www.flaticon.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].