Usage
import { MultilineTextField } from 'nr1'
Examples
Props
Provide a label for screen readers to describe this input. This is
only required if the screen reader label should be different to the
label
prop, or if you are not providing a label
prop at all.
Provide the unique id
of an element whose contents describe this
input for screen readers. This is only required if the screen reader
label should be different to the label
prop, or if you are not
providing a label
prop at all. Use this or ariaLabel
, not both.
false
If true
, the multiline text field will autofocus on mount.
Appends class names to the component.
Should be used only for positioning and spacing purposes.
Default value of the multiline text field.
Message with instructions on how to fill the form field.
Establishes whether the field can be editable or not.
Additional information can be displayed in an info tooltip next to the Label.
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 boolean
field or a string
. When it is a string
, as
well as the invalid state being shown, the text will be shown below.
Text to display as label.
Display the label inline the form control.
Use only when the component is not inside a Form
. In that case set
layoutType
to Form.LAYOUT_TYPE.SPLIT
in the Form
component.
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 true
, shows a loading spinner; and when set to false
, reserves
some space in the UI so that the spinner can potentially be shown.
Do not set the property (or set it to undefined
) if the field is
not expected to get loading at any given point in time.
Callback which is fired when the multiline text field loses focus.
function (event: React.FocusEvent Event source of the callback.
)
Callback which is fired when the multiline text field value changes.
function (event: React.ChangeEvent Event source of the callback. You
can pull out the new value by accessing event.target.value
.
)
Callback which is fired when the multiline text field gets focus.
function (event: React.FocusEvent Event source of the callback.
)
Callback which is fired when a key is pressed.
function (event: React.KeyboardEvent Event source of the callback.
)
Callback which is fired when a key is released.
function (event: React.KeyboardEvent Event source of the callback.
)
Hint displayed in the multiline text field when it has no value.
If true
, makes the multiline text field read only.
false
If true
, denotes the form field as required.
5
Amount of rows in the text field.
The minimum required is five rows.
Spacing property. Spacing is defined as a tuple of zero to four
values, which follow the same conventions as CSS properties like
margin
or padding
. To omit a value, use SPACING_TYPE.OMIT
.
<Array of<One ofMultilineTextField.SPACING_TYPE.EXTRA_LARGE,MultilineTextField.SPACING_TYPE.LARGE,MultilineTextField.SPACING_TYPE.MEDIUM,MultilineTextField.SPACING_TYPE.NONE,MultilineTextField.SPACING_TYPE.OMIT,MultilineTextField.SPACING_TYPE.SMALL,>
>
If true
, enables the browser check for spelling errors.
Inline style for custom styling.
Should be used only for positioning and spacing purposes.
Adds a data-test-id
attribute. Use it to target the component in unit and
E2E tests.
For a test id to be valid, prefix it with your nerdpack id, followed up by a dot.
For example, my-nerdpack.some-element
.
Note: You might not see data-test-id
attributes as they are removed
from the DOM, to debug them pass a e2e-test
query parameter to the URL.
MultilineTextField .TYPE .NORMAL
- NORMAL — when a user inputs text into a field
- PERFORMATTED — when a user needs to enter monospaced content
<One ofMultilineTextField.TYPE.NORMAL,MultilineTextField.TYPE.PREFORMATTED,>
Value of the multiline text field.
This is required for a controlled component.