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

drag-fab-button

v2.0.6

Published

Draggable FAB button component for Angular and Ionic applications

Readme

drag-fab-button

A draggable floating action button (FAB) component for Angular and Ionic applications. Built with TypeScript and optimized for mobile touch interactions.

Features

  • Draggable FAB: Smooth drag interactions on mobile and desktop
  • Touch Optimized: 60fps animation throttling for smooth performance
  • Boundary Detection: Prevents FAB from leaving screen boundaries
  • Click Detection: Distinguishes between drag and click operations
  • Configurable: Customize icon, color, initial position, and more
  • Event Emitters: Track drag start, drag end, position changes, and clicks
  • TypeScript Support: Full TypeScript definitions included

Installation

npm install drag-fab-button

Usage

Basic Import

import { DragFabButtonModule } from 'drag-fab-button';

@NgModule({
  imports: [DragFabButtonModule]
})
export class AppModule { }

In Your Template

<drag-fab-button
  icon="document-text-outline"
  color="primary"
  (fabClick)="onFabClick()"
  (dragEnd)="onDragEnd($event)">
</drag-fab-button>

Component API

Inputs

| Property | Type | Default | Description | |----------|------|---------|-------------| | icon | string | 'document-text-outline' | Ionicon name for the FAB icon | | iconStyle | string | '' | Additional CSS classes for the icon | | color | string | 'primary' | Ionic button color (primary, secondary, success, danger, warning, etc.) | | position | DragPosition | {bottom: 16, right: 16} | Initial position with bottom and right properties in pixels | | disabled | boolean | false | Disable FAB interactions |

Outputs

| Event | Payload | Description | |-------|---------|-------------| | fabClick | void | Emitted when FAB is clicked (not dragged) | | dragStart | void | Emitted when drag interaction starts | | dragEnd | DragPosition | Emitted when drag interaction ends with final position | | positionChange | DragPosition | Emitted continuously during drag with current position |

DragPosition Interface

export interface DragPosition {
  bottom: number;  // Distance from bottom in pixels
  right: number;   // Distance from right in pixels
}

Example Implementation

import { Component } from '@angular/core';
import { DragPosition } from 'drag-fab-button';

@Component({
  selector: 'app-root',
  template: `
    <ion-content>
      <h1>Drag the FAB button!</h1>
      <p>Current position: {{ currentPosition | json }}</p>
    </ion-content>

    <drag-fab-button
      icon="add"
      color="primary"
      [position]="currentPosition"
      (fabClick)="onFabClick()"
      (positionChange)="onPositionChange($event)"
      (dragEnd)="onDragEnd($event)">
    </drag-fab-button>
  `
})
export class AppComponent {
  currentPosition: DragPosition = { bottom: 16, right: 16 };

  onFabClick(): void {
    console.log('FAB clicked!');
  }

  onPositionChange(position: DragPosition): void {
    this.currentPosition = position;
  }

  onDragEnd(position: DragPosition): void {
    console.log('Drag ended at:', position);
  }
}

Performance

  • 60fps Animation: Throttled drag updates maintain smooth 60fps performance
  • Boundary Detection: Prevents layout thrashing with smart boundary calculations
  • Touch Optimization: Millisecond-precision touch event handling

Browser Support

  • Chrome/Edge 60+
  • Firefox 55+
  • Safari 12+
  • Mobile browsers (iOS Safari 12+, Chrome Android)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit pull requests.

Support

For issues, feature requests, or questions, please visit the GitHub repository.