All Components

Inputs Overview

The Inputs are fields which allow for an input of data, based on a specific and predefined format.

The package includes the following components:

  • MaskedTextBox—Uses a mask to control the input of the user.
  • NumericTextBox—Lets the user edit and submit specific numeric values by typing or by using the spin buttons.
  • Slider—Lets the user select a value from a predefined range. The values can be increased or decreased over a predefined step by dragging the handle along the track, or by clicking the side arrow buttons. The component supports two modes of display—horizontal and vertical.
  • Switch—Lets the user toggle between checked and unchecked states.

The components below are on the Roadmap and will be included in future versions:

  • ColorPicker

Basic Usage

The following example demonstrates the MaskedTextBox, NumericTextBox, Slider, and Switch components in action.

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

@Component({
    selector: 'my-app',
    template: `
    <div class="example-wrapper">
        <div class="row">
            <div class="col-xs-12 col-sm-6 example-col">
                <p>MaskedTextBox</p>
                <kendo-maskedtextbox
                    [(ngModel)]="maskedValue"
                    [mask]="'9-000'"
                ></kendo-maskedtextbox>
            </div>
            <div class="col-xs-12 col-sm-6 example-col">
                <p>NumericTextBox</p>
                <kendo-numerictextbox
                    [(ngModel)] = "numericValue"
                ></kendo-numerictextbox>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-6 example-col">
                <p>Slider (value = {{sliderValue}})</p>
                <kendo-slider
                    [min]="min"
                    [max]="max"
                    [smallStep]="smallStep"
                    [(ngModel)] = "sliderValue"
                ></kendo-slider>
            </div>
            <div class="col-xs-12 col-sm-6 example-col">
                <p>Switch</p>
                <kendo-switch [(ngModel)]="switchValue"></kendo-switch>
            </div>
        </div>
    </div>
    `
})

export class AppComponent {
    public maskedValue: string;
    public sliderValue: number = 5;
    public numericValue: number = 5;
    public switchValue: boolean = false;
    public min: number = 0;
    public max: number = 10;
    public smallStep: number = 1;
}

import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { InputsModule } from '@progress/kendo-angular-inputs';
import { AppComponent } from './app.component';

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

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

enableProdMode();

const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

Installation

All components referenced during the installation will be present in the final bundle of your application. To avoid ending up with components you do not actually need, you can either import all Inputs components at once by using the InputsModule or import a specific Inputs component by importing it as an individual NgModule.

  1. The Inputs package is published on the Progress NPM Registry. To set up your access, follow the steps in Installation.

  2. Download and install the package:

    npm install --save @progress/kendo-angular-inputs @progress/kendo-angular-intl @progress/kendo-angular-l10n
  3. Once installed, you can import the NgModule of the components you need.

    To get all package components, import the InputsModule in your application root module:

    import { NgModule } from '@angular/core';
       import { BrowserModule } from '@angular/platform-browser';
       import { InputsModule } from '@progress/kendo-angular-inputs';
       import { AppComponent } from './app.component';
    
       @NgModule({
           bootstrap:    [AppComponent],
           declarations: [AppComponent],
           imports:      [BrowserModule, InputsModule]
       })
       export class AppModule {
       }

    The package also exports the following modules for individual components:

    • MaskedTextBoxModule
    • NumericTextBoxModule
    • SliderModule
    • SwitchModule

    To reduce the size of your application, include only the ones you need:

    import { NgModule } from '@angular/core';
    
       // Imports the MaskedTextBox module
       import { MaskedTextBoxModule } from '@progress/kendo-angular-inputs';
    
       // Imports the NumericTextBox module
       import { NumericTextBoxModule } from '@progress/kendo-angular-inputs';
    
       @NgModule({
           bootstrap: [AppComponent],
           imports: [MaskedTextBoxModule, NumericTextBoxModule]
       })
       export class AppModule {}

Dependencies

The Inputs package requires the following peer dependencies that have to be installed by your application:

  • @angular/common
  • @angular/core
  • @angular/forms
  • @progress/kendo-angular-intl
  • @progress/kendo-angular-l10n
  • rxjs

The following dependencies will be installed automatically:

  • @telerik/kendo-draggable
  • @telerik/kendo-inputs-common
In this article