InputText is an extension to standard input element with theming and keyfiltering.
import { InputText } from 'primereact/inputtext';
<script src="https://unpkg.com/primereact/core/core.min.js"></script>
InputText is used as a controlled input with value and onChange properties.
<InputText value={value} onChange={(e) => setValue(e.target.value)} />
A floating label is implemented by wrapping the input and the label inside a container having .p-float-label style class.
<span className="p-float-label">
<InputText id="in" value={value} onChange={(e) => setValue(e.target.value)} />
<label htmlFor="in">Username</label>
</span>
InputText has built-in key filtering support to block certain keys, refer to keyfilter page for more information.
InputText passes any valid attribute to the underlying React HTMLInputElement element. Extended properties are as follows;
Name | Type | Default | Description |
---|---|---|---|
keyfilter | string/regex | null | Format definition of the keys to block. |
validateOnly | boolean | false | When enabled, instead of blocking keys, input is validated internally to test against the regular expression. |
tooltip | any | null | Content of the tooltip. |
tooltipOptions | object | null | Configuration of the tooltip, refer to the tooltip documentation for more information. |
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-inputtext | Input element |
This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.
None.
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.