InputText

    InputText is an extension to standard input element with theming and keyfiltering.

    
    import { InputTextModule } from 'primeng/inputtext';
    
    

    InputText is used as a controlled input with ngModel property.

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

    InputText can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

    
    <input type="text" pInputText formControlName="text" />
    
    

    FloatLabel visually integrates a label with its form element. Visit FloatLabel documentation for more information.

    
    <p-floatlabel>
        <input pInputText id="over_label" [(ngModel)]="value1" autocomplete="off" />
        <label for="over_label">Over Label</label>
    </p-floatlabel>
    
    <p-floatlabel variant="in">
        <input pInputText id="in_label" [(ngModel)]="value2" autocomplete="off" />
        <label for="in_label">In Label</label>
    </p-floatlabel>
    
    <p-floatlabel variant="on">
        <input pInputText id="on_label" [(ngModel)]="value3" autocomplete="off" />
        <label for="on_label">On Label</label>
    </p-floatlabel>
    
    

    IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.

    
    <p-iftalabel>
        <input pInputText id="username" [(ngModel)]="value" autocomplete="off" />
        <label for="username">Username</label>
    </p-iftalabel>
    
    

    InputText provides small and large sizes as alternatives to the standard.

    
    <input pInputText [(ngModel)]="value1" type="text" size="small" placeholder="Small" />
    <input pInputText [(ngModel)]="value2" type="text" placeholder="Normal" />
    <input pInputText [(ngModel)]="value3" type="text" size="large" placeholder="Large" />
    
    

    An advisory text can be defined with the semantic small tag.

    Enter your username to reset your password.
    
    <div class="flex flex-col gap-2">
        <label for="username">Username</label>
        <input pInputText id="username" aria-describedby="username-help" [(ngModel)]="value" />
        <small id="username-help">Enter your username to reset your password.</small>
    </div>
    
    

    Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

    
    <input type="text" pInputText [(ngModel)]="value" variant="filled" />
    
    

    Invalid state style is added using the ng-invalid and ng-dirty class to indicate a failed validation.

    
    <input pInputText [(ngModel)]="value"  class="ng-invalid ng-dirty" />
    
    

    When disabled is present, the element cannot be edited and focused.

    
    <input pInputText [disabled]="true" [(ngModel)]="value" />
    
    

    Screen Reader

    InputText component renders a native input element that implicitly includes any passed prop. Value to describe the component can either be provided via label tag combined with id prop or using aria-labelledby, aria-label props.

    
    <label for="firstname">Firstname</label>
    <input pInputText id="firstname" />
    
    <span id="lastname">Lastname</span>
    <input pInputText aria-labelledby="lastname" />
    
    <input pInputText aria-label="Age" />
    
    

    Keyboard Support

    KeyFunction
    tabMoves focus to the input.