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

@nutrify/ngx-simple-spinner

v1.0.3

Published

Simple and lightweight, yet customizable spinner/number input module for Angular

Downloads

3

Readme

Ngx Simple Spinner

Simple and lightweight, yet customizable spinner/number input module for Angular.

Demo
Netlify Status

This is a number input component for Angular, fully supporting template driven forms and form validation. It is completely customizable using SCSS/CSS. Additionally it features: displaying most common fractions (1/2, 1/3, 1/4, ...), setting decimal places, i18n and RTL (right-to-left). It replicates Google Chrome's behaviour regarding its base functionality.

Installation

Ngx Simple Spinner requires Angular 9 or above.

npm install @nutrify/ngx-simple-spinner --save

You might also need to install @angular/cdk:

npm install @angular/cdk --save

For styling import @nutrify/ngx-simple-spinner/scss/styles.scss or @nutrify/ngx-simple-spinner/css/styles.css

Usage

app.module.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { SimpleSpinnerModule } from '@nutrify/ngx-simple-spinner';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    SimpleSpinnerModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

component.ts:

// ...

export class Component {
  value = 12.5;
}

component.html:

<!-- ... -->

<simple-spinner [(ngModel)]="value" min="1" max="100" smallStep="0.25" maxDecimalPlaces="2" fractions="true"></simple-spinner>

<!-- ... -->

Check out the source code for an example.

Spinner

Inputs

| Property | Default | Description | | ---------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------- | | placeholder | | Optional placeholder string, which gets displayed when value == null | | value | | Value of the number input | | min | Number.MIN_SAFE_INTEGER | Minimum value (can be a float value) | | max | Number.MAX_SAFE_INTEGER | Maximum value (can be a float value) | | bigStep | 1 | Number by which the current value should be in-/decremented using the nav/keyboard (can be a float value) | | smallStep | 0.25 | Number by which the current value should be in-/decremented if 'bigStep' can't be applied (can be a float value) | | maxDecimalPlaces | 0 | Maximum amount of decimal places that should be allowed to enter (exceeding decimal places get trimmed) | | fractions | false | Boolean describing whether or not fractions should be rendered | | i18nNumbers | true | E.g. converts 0-9 to arabic digits, if arabic is the browser's default language | | hoverBorder | false | Boolean describing whether or not the border should only render on hover | | hoverNav | true | Boolean describing whether or not the navigation should only render on hover | | dir | | Optional direction property describing the content's orientation. Can be: 'ltr' \| 'rtl' \| 'auto' |

Directives

| Property | Description | | -------- | --------------------------- | | disabled | Sets the disabled attribute | | required | Sets the required attribute |

Styling

You can use SCSS or CSS for styling.

Just import the stylesheet and apply changes to it.

The SCSS stylesheet is recommended since it exports more variables.

If you are not using SCSS for your Angular projects already, you really should.

The migration is very easy.

CSS / SASS

@import '~@nutrify/ngx-simple-spinner/scss/styles';

Angular

angular-cli.json:

"styles": [
  "styles.css",

  "../node_modules/@nutrify/ngx-simple-spinner/css/styles.css"
]