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-slider-captcha

v0.1.1

Published

A modern Angular slider captcha component that provides a puzzle-based verification system

Readme

NgxSliderCaptcha

A modern Angular slider captcha component that provides a puzzle-based verification system. Users need to slide a puzzle piece to complete the captcha challenge.

Features

  • 🎯 Puzzle-based verification: Users slide a puzzle piece to complete the captcha
  • ⏱️ Configurable timeout: Set custom timeout for captcha completion
  • 🖼️ Custom images: Use your own images or random images from Picsum
  • 📱 Touch support: Works on both desktop and mobile devices
  • 🎨 Modern UI: Clean and responsive design
  • Angular 17+: Built with the latest Angular features and standalone components

Installation

npm install ngx-slider-captcha

Usage

Basic Usage

Import the NgxSliderCaptcha component in your Angular module or standalone component:

import { NgxSliderCaptcha } from "ngx-slider-captcha";

@Component({
  selector: "app-example",
  imports: [NgxSliderCaptcha],
  template: ` <ngx-slider-captcha (success)="onCaptchaSuccess($event)" (failed)="onCaptchaFailed()" /> `,
})
export class ExampleComponent {
  onCaptchaSuccess(event: CaptchaSuccess) {
    console.log("Captcha completed successfully!", event.value);
  }

  onCaptchaFailed() {
    console.log("Captcha failed or timed out");
  }
}

With Custom Configuration

import { NgxSliderCaptcha, CaptchaConfig } from "ngx-slider-captcha";

@Component({
  selector: "app-example",
  imports: [NgxSliderCaptcha],
  template: ` <ngx-slider-captcha [config]="captchaConfig" (success)="onCaptchaSuccess($event)" (failed)="onCaptchaFailed()" /> `,
})
export class ExampleComponent {
  captchaConfig: CaptchaConfig = {
    image: "https://example.com/your-custom-image.jpg",
    failTimeout: 30000, // 30 seconds
  };

  onCaptchaSuccess(event: CaptchaSuccess) {
    console.log("Captcha completed!", event.value);
  }

  onCaptchaFailed() {
    console.log("Captcha failed");
  }
}

Configuration

CaptchaConfig Interface

interface CaptchaConfig {
  image: string; // URL of the image to use for the captcha
  failTimeout: number; // Timeout in milliseconds (default: 60000ms)
}

Properties

| Property | Type | Default | Description | | -------- | --------------- | ----------------------------------- | ------------------------------------ | | config | CaptchaConfig | { image: '', failTimeout: 60000 } | Configuration object for the captcha |

Events

| Event | Type | Description | | --------- | ---------------- | -------------------------------------------------- | | success | CaptchaSuccess | Emitted when the captcha is completed successfully | | failed | void | Emitted when the captcha times out or fails |

CaptchaSuccess Interface

interface CaptchaSuccess {
  value: number; // The position value when the captcha was completed
}

Examples

Example 1: Basic Implementation

import { Component } from "@angular/core";
import { NgxSliderCaptcha, CaptchaSuccess } from "ngx-slider-captcha";

@Component({
  selector: "app-login",
  imports: [NgxSliderCaptcha],
  template: `
    <div class="login-form">
      <h2>Login</h2>
      <input type="email" placeholder="Email" />
      <input type="password" placeholder="Password" />

      <div class="captcha-container">
        <ngx-slider-captcha (success)="onCaptchaSuccess($event)" (failed)="onCaptchaFailed()" />
      </div>

      <button [disabled]="!captchaCompleted">Login</button>
    </div>
  `,
})
export class LoginComponent {
  captchaCompleted = false;

  onCaptchaSuccess(event: CaptchaSuccess) {
    this.captchaCompleted = true;
    console.log("Captcha verified!");
  }

  onCaptchaFailed() {
    this.captchaCompleted = false;
    console.log("Please complete the captcha");
  }
}

Example 2: Custom Image and Timeout

import { Component } from "@angular/core";
import { NgxSliderCaptcha, CaptchaConfig } from "ngx-slider-captcha";

@Component({
  selector: "app-registration",
  imports: [NgxSliderCaptcha],
  template: ` <ngx-slider-captcha [config]="captchaConfig" (success)="onCaptchaSuccess($event)" (failed)="onCaptchaFailed()" /> `,
})
export class RegistrationComponent {
  captchaConfig: CaptchaConfig = {
    image: "https://your-domain.com/captcha-images/random.jpg",
    failTimeout: 45000, // 45 seconds
  };

  onCaptchaSuccess(event: CaptchaSuccess) {
    // Handle successful captcha completion
    this.submitRegistration();
  }

  onCaptchaFailed() {
    // Handle captcha failure
    alert("Please complete the captcha within the time limit");
  }

  private submitRegistration() {
    // Submit registration form
  }
}

Styling

The component comes with built-in styles, but you can customize the appearance using CSS:

// Custom styles for the captcha container
.captcha-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  background: #f9f9f9;
}

// Custom slider styles
.slider {
  background: #007bff;
  border-radius: 4px;

  &:hover {
    background: #0056b3;
  }
}

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Mobile browsers (iOS Safari, Chrome Mobile)

Requirements

  • Angular 17.0.0 or higher
  • TypeScript 5.0 or higher

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License.

Author

Hussein AbdElaziz