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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngx-floating

v1.0.2

Published

<div align="center"> <h1>NGX-FLOATING</h1> <p>A lightweight and powerful Angular floating UI solution with flexible positioning and draggable support.</p> <p align="center"> <a href="README_CN.md">中文文档</a><span> | </span><span>English</span> <

Readme


✨ Features

  • 🚀 Lightweight – No external dependencies
  • 📦 Multiple Usage Modes – Component, Directive, or Service
  • 🎯 Flexible Positioning – Dynamic alignment with inner/outer positioning support
  • 🖱️ Drag & Drop Support – Optional movable functionality with boundary constraints
  • 🔄 Auto Boundary Detection – Smart repositioning within containers
  • 🎨 Customizable Styling – Full control over appearance and content
  • 🔧 Responsive Design – Automatically adjusts to container size changes

🛠 Installation

npm install ngx-floating

🚀 Usage

1. Import the Module

import { NgxFloatingComponent, NgxFloatingDirective } from 'ngx-floating';

@Component({
  // ...
  imports: [NgxFloatingComponent, NgxFloatingDirective],
})

2. Component Mode

<div #target>
  <ngx-floating 
    [at]="target" 
    [movable]="true" 
    [offset]="{ right: 10, bottom: 10, inner: true }" 
    [boundary]="target">
    <div>Floating Content</div>
  </ngx-floating>
</div>

3. Directive Mode

<div #target>
  <div [ngxFloating]="true" 
       [movable]="true" 
       [at]="target" 
       [offset]="{ top: 0, right: 0 }"
       [ignoreBoundary]="false">
    Floating Content
  </div>
</div>

4. Service Mode

import { NgxFloatingService } from 'ngx-floating';

export class YourComponent {
  constructor(private floatingService: NgxFloatingService) {}

  createFloating() {
    this.floatingService.create('floating-id', {
      at: targetElement,
      movable: true,
      offset: { top: 0, right: 0 },
      content: 'Floating Content' // Supports string, template ref, or component
    });
  }

  toggleVisibility() {
    this.floatingService.show('floating-id'); // Show
    this.floatingService.hide('floating-id'); // Hide
  }

  cleanup() {
    this.floatingService.destroy('floating-id'); // Destroy
  }
}

📚 API Reference

NgxFloatingComponent / NgxFloatingDirective

| Property | Type | Default | Description | |-----------------|-------------------------------|--------------------------|-----------------------------------------------------------------------------| | at | HTMLElement | Required | Target element for positioning | | movable | boolean | false | Enable drag-and-drop functionality | | offset | FloatingOffset | { top: 0 } | Positioning offsets | | boundary | HTMLElement | documentElement | Boundary element to constrain movement | | ignoreBoundary| boolean | false | Disable boundary constraints | | zIndex | number | 2 | Z-index of the floating element | | isVisible | boolean | true | Control visibility | | content | TemplateRef | Type | string | - | Content (Service mode only) |

FloatingOffset Interface

interface FloatingOffset {
  top?: number;
  right?: number;
  bottom?: number;
  left?: number;
  inner?: boolean; // Position relative to the inner area of the target
}

Component Instance Methods

| Method | Description | |------------|------------------------------------------| | show() | Show the floating element | | hide() | Hide the floating element | | reset() | Reset position to initial state |

NgxFloatingService Methods

| Method | Parameters | Description | |------------|---------------------------------|------------------------------------------| | create | (id: string, options: NgxFloatingServiceOptions) | Create a floating instance | | destroy | (id: string) | Destroy a floating instance | | show | (id: string) | Show the floating element | | hide | (id: string) | Hide the floating element | | reset | (id: string) | Reset position to initial state | | get | (id: string) | Retrieve a floating instance by ID |


🌐 Live Demo

Explore interactive examples at the Demo Page.


📜 License

MIT © 2025 Eternal Heart