Forms allow a user to provide input to complete a task.
Usage
import { TextField } from 'nr1'
Examples
Basic
<TextField label="Username" placeholder="e.g. John Doe" />
With inline label
<TextField label="Username" labelInline placeholder="e.g. John Doe" />
Search
<TextField type={TextField.TYPE.SEARCH} placeholder="e.g. Placeholder" />
Password
<TextField type={TextField.TYPE.PASSWORD} placeholder="e.g. Placeholder" />
Preformatted
<TextField type={TextField.TYPE.PREFORMATTED} placeholder="npm run build" />
Loading
<TextField loading placeholder="e.g Placeholder" />
Disabled
<TextField defaultValue="Some value" disabled placeholder="e.g Placeholder" />
Read only
<TextField defaultValue="Some value" readOnly placeholder="e.g Placeholder" />
With description
<TextField description="Description value" placeholder="e.g Placeholder" />
With invalid message
<TextField invalid="Not enough text, needs more" placeholder="e.g Placeholder"/>
Props
string | Provide a label for screen readers to describe this input. This is only required if the screen reader label should be different to the |
string | Provide the unique |
boolean | If |
string | Appends class names to the component.Should be used only for positioning and spacing purposes. |
string | Default value of the text field. |
string | Message with instructions on how to fill the form field. |
boolean | Establishes whether the field can be editable or not. |
string | Additional information can be displayed in an info tooltip next to the Label. |
boolean|string | When true, sets the field in an invalid state, in order to notify the user attention is needed over this particular field. This property can be a |
string | Text to display as label. |
boolean | Display the label inline the form control.Use only when the component is not inside a |
boolean | If loading a list of data or something else into a form field, indicate to the user that something is loading by using the loading state form.Used to inform that the field might load values dynamically. When set to |
DEPRECATEDboolean | Due January 1st, 2022The "multiline" prop is deprecated, use MultilineTextField component instead for multiline purposes. Whether the input accepts one or more lines. This also affects the behavior of the [Enter] key, which will create a new line, as opposed to a no-op in a single-line field. |
function | Callback which is fired when the text field loses focus. function ( |
function | Callback which is fired when the text field value changes. function ( |
function | Callback which is fired when the text field gets focus. function ( |
function | Callback which is fired when a key is pressed. function ( |
function | Callback which is fired when a key is released. function ( |
string | Hint displayed in the text field when it has no value. |
boolean | If |
boolean | If |
enum[] | Spacing property. Spacing is defined as a tuple of zero to four values, which follow the same conventions as CSS properties like <Array of |
boolean | If |
object | Inline style for custom styling.Should be used only for positioning and spacing purposes. |
string | Adds a |
enum |
|
string | Value of the text field.This is required for a controlled component. |