Inputtext InputText is an extension to standard input element with theming.

Basic

{{text}}

Disabled

Import


import {InputTextModule} from 'primeng/primeng';

Getting Started

InputText is applied to an input field with pInputText directive.


<input type="text" pInputText />

Model Binding

A model can be bound using standard ngModel directive.


<input type="text" pInputText [(ngModel)]="property"/>

Attributes

Name Type Default Description
disabled boolean false When present, it specifies that the element should be disabled.

Styling

Following is the list of structural style classes, for theming classes visit theming page.

Name Element
ui-inputtext Input element

Dependencies

None.


<h3 class="first">Basic</h3>
<input id="in" type="text" size="30" pInputText [(ngModel)]="text" />  {{text}}

<h3>Disabled</h3>
<input id="in" type="text" size="30" pInputText [disabled]="disabled" />

<button type="button" (click)="toggleDisabled()" pButton label="Toggle"></button>


export class InputTextDemo {

    text: string;

    disabled: boolean = true;

    toggleDisabled() {
        this.disabled = !this.disabled;
    }
}