Components / Library version 3.28.0
The Input component provides an accessible text input field. See properties for all functionality.
Properties
Examples
Events
Accessibility
Notes
* Required property
label
*
string
A description for the input. Required even if the label-position
is set to none (for accessibility reasons).
character-limit
number
The maximum number of characters the user can type. The character count and limit will be displayed on the right side of the field. Character limiting is disabled when this property is unset.
disabled
boolean
Disables the component.
error-message
string
Set this string to display an error message.
info
string
Set the info text displayed under the input field.
label-position
top | left | none
Defaults to top
. Set to none
if no label should be displayed.
min
number
For use with type="number"
, the minimum value that can be reached using the stepper.
max
number
For use with type="number"
, the maximum value that can be reached using the stepper.
placeholder
string
Set the placeholder text within the input field.
prevent-validation
string
Validation will not occur when clicking on an element with this id. Accepts multiple ids separated by spaces. See
Notes tab for more information.
required-field
boolean
Set this property to indicate this input as required.
required-field-message
string
The message to display when an error is displayed due to the field being left empty. If not set, this message will be: "This field is required."
step
number
For use with type="number"
, the interval used when stepping between values.
symbol-before
string
Display the string before the value (e.g. "$").
symbol-after
string
Display the string after the value (e.g. "%").
text-after
string
Display the string after the input. This text should be no longer than 55 characters.
type
text | number
The input's type, defaults to text
.
value
string
The value to initially set the input field, or the input field's current value.
Edit the code below to see changes reflected in the example above.
Code generated from HTML.
wmInputValueChanged
Emitted on blur when Input's value changes.
input
Emitted when a user types in the input field.
Error messages will be announced via live-region. If the info
property is present, info text will be read upon focusing the input field.
The prevent validation
prop is used with a specific use-case in mind.
When components that feature required fields are initally focused within a modal, closing the modal will flash the required error.
The prevent validation
prop is useful in this case, where the close button's id can be passed through preventing the validation flash.