1.2.0 • Published 2 years ago

ngx-mat-number-input-spinner v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

NgxMatNumberInputSpinner

Number Spinner component for Angular Material

w3soto

StackBlitz Demo

Screenshot

Features

  • Replace default browser spinner
  • Custom buttons (prefix/suffix) for increment and decrement value
  • Read step, min, max, readonly and disabled properties from input element

Installation

npm -i ngx-mat-number-input-spinner

Example

For more details see projects/demo application

import { NgxMatNumberInputSpinnerModule } from "ngx-mat-number-input-spinner";
...

@NgModule({
  imports: [
    ...,
    NgxMatNumberInputSpinnerModule,
  ],
  ...
})
class AppModule { ... }

Basic template

<mat-form-field>
  
  <input
    matInput
    type="number"
    step=".5"
    min="-10"
    max="10"
    [ngxMatNumberSpinner]="spinner"
    [(ngModel)]="myNumberInputValue">

    <ngx-mat-number-spinner #spinner matSuffix></ngx-mat-number-spinner>
    
</mat-form-field>

Custom template

<mat-form-field>
  
  <input 
    matInput 
    type="number" 
    min="0" 
    max="5" 
    value="0"
    [ngxMatNumberSpinner]="[spinnerUp,spinnerDown]">
    
  <button 
    mat-icon-button 
    color="primary" 
    matPrefix 
    ngxMatNumberIncrementSpinner
    #spinnerUp="ngxMatNumberIncrementSpinner">
    <mat-icon>thumb_up</mat-icon>
  </button>
  
  <button 
    mat-icon-button 
    color="warn" 
    matSuffix 
    ngxMatNumberDecrementSpinner
    #spinnerDown="ngxMatNumberDecrementSpinner">
    <mat-icon>thumb_down</mat-icon>
  </button>
  
</mat-form-field>

Components

  • ngx-mat-number-spinner
@InputTypeDefaultDescription
autoDelaynumber500Delay timeout in milliseconds
autoRepeatnumber25Repeat interval in milliseconds

Exported as ngxMatNumberSpinner

Directives

@InputDescription
ngxMatNumberSpinnerReference to ngx-mat-number-spinner or list of references to ngxMatNumberIncrementSpinner and ngxMatNumberDecrementSpinner

Exported as ngxMatNumberSpinnerInput

  • ngxMatNumberIncrementSpinner
@InputTypeDefaultDescription
ngxMatNumberIncrementSpinnerAutoDelaynumber500Delay timeout in milliseconds
ngxMatNumberIncrementSpinnerAutoRepeatnumber25Repeat interval in milliseconds

Exported as ngxMatNumberIncrementSpinner

  • ngxMatNumberDecrementSpinnerFor
@InputTypeDefaultDescription
ngxMatNumberDecrementSpinnerAutoDelaynumber500Delay timeout in milliseconds
ngxMatNumberDecrementSpinnerAutoRepeatnumber25Repeat interval in milliseconds

Exported as ngxMatNumberDecrementSpinner

1.2.0

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago