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

ngx-knob

v1.1.0

Published

An Angular component for creating knob controllers to adjust values within a specified range.

Downloads

27

Readme

NgxKnob

NgxKnob is an Angular component that provides a knob controller allowing users to adjust values within a specified range. This component supports both mouse and touch interactions and can be easily integrated into Angular projects.

Live Demo

Features

  • Adjustable Value: Allows users to change the value between a minimum and maximum range using mouse or touch.
  • Form Integration: Can be used with Angular forms as a ControlValueAccessor.
  • Validation Support: Supports validation of input values.

Installation

To install the library, use npm:

npm install ngx-knob --save

Usage

Importing the Module

First, add the NgxKnobModule to your Angular module:

import { NgxKnobModule } from 'ngx-knob';

@NgModule({
  imports: [
    NgxKnobModule,
    // other modules
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

Using in a Template

Use the ngx-knob component in your template as follows:

<ngx-knob [min]="0" [max]="100" [(ngModel)]="value" title="HEATING"></ngx-knob>

Component Setup

In your component, define the value property:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  value = 50;
}

Inputs and Outputs

Inputs

| Input | Type | Default | Description | | ------------- | ------------- | ---------------------------------------------------- | ---------------------------------------------- | | title | string | 'HEATING' | The title displayed above the knob. | | min | number | 0 | The minimum value that the knob can represent. | | max | number | 100 | The maximum value that the knob can represent. | | value | number | 0 | The current value of the knob. | | colorRanges | IColorRange | [ { "color": "#985EE1" }, { "color": "#F25656" } ] | The color range3 |

Outputs

| Output | Type | Description | | -------- | ---------------------- | ------------------------------------------------------ | | change | EventEmitter<number> | Emits the new value whenever the knob's value changes. |

Example

Here is a complete example of how to use the ngx-knob component:

<ngx-knob [min]="0" [max]="100" [(ngModel)]="value" title="HEATING"></ngx-knob>
<p>Value: {{ value }}</p>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  value = 50;
}

Development and Contribution

If you want to contribute to this library, you can clone the repository and make your changes:

git clone https://github.com/mr-samani/ngx-knob.git
cd ngx-knob
npm install

Running Locally

To run the project locally and see your changes:

ng serve

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Author

💻Mohammadreza samani | FrontEnd Developer

❤️Buy me a coffee 😉