A form text field used for entering a single line of text, such as name, email and other short text. A text box will always have a label. If it is a required field, it should be marked with an asterisk* alongside the label. Guidance text is optional, and used to guide the user on what’s expected.
Usage
Used to allow a user to type in text information that is no longer than a single line.
Do:
only use text input if the text to be entered is a single line, if it is multi-line text, then use Text area
make sure the size of the input field is appropriate for the content length the user may enter
include a visible label that informs the user about the content they need to enter in the field
use a <label> tag in HTML to describe the purpose of the input field
Avoid:
using text input if a user can only enter an option from a predefined list, use dropdown, select, or radio button group instead
using placeholder text due to accessibility concerns, including its unavailability to certain assistive technologies, potential colour and contrast issues, and the risk of users mistaking the input as pre-filled
Parameters for turas-text-box
asp-for - binds the text box to a model property
guidance-text - provides additional guidance for the user
field-column-widths - sets the column width for the text box
additional-classes - allows for custom CSS classes to be added
hide-validation-message - suppresses validation messages for the field
readonly - makes the text box read-only
asp-is-disabled - disables the text box
hide-label - hides the label associated with the text box