InputTextarea

InputTextarea adds styling and autoResize functionality to standard textarea element.


import { InputTextarea } from 'primereact/inputtextarea';
         

Textarea is used as a controlled input with value and onChange properties.


<InputTextarea value={value} onChange={(e) => setValue(e.target.value)} rows={5} cols={30} />
         

When autoResize is enabled, textarea grows instead of displaying a scrollbar.


<InputTextarea autoResize value={value} onChange={(e) => setValue(e.target.value)} rows={5} cols={30} />
         

InputTextarea has built-in key filtering support to block certain keys, refer to keyfilter page for more information.


<InputTextarea keyfilter="int" placeholder="Integers" rows={5} cols={30} />
         

A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.


<FloatLabel>
    <InputTextarea id="username" value={value} onChange={(e) => setValue(e.target.value)} rows={5} cols={30} />
    <label htmlFor="username">Username</label>
</FloatLabel>
         

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


<InputTextarea variant="filled" value={value} onChange={(e) => setValue(e.target.value)} rows={5} cols={30} />
         

Invalid state is displayed using the invalid prop to indicate a failed validation. You can use this style when integrating with form validation libraries.


<InputTextarea invalid rows={5} cols={30} />
         

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


<InputTextarea disabled rows={5} cols={30} />
         

Screen Reader

InputTextarea component renders a native textarea 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 htmlFor="address1">Address 1</label>
<InputTextarea id="address1" />

<span id="address2">Address 2</span>
<InputTextarea aria-labelledby="address2" />

<InputTextarea aria-label="Address Details"/>
     

Keyboard Support

KeyFunction
tabMoves focus to the input.