Use a text box when the user needs to enter a single line of text, such as a name or email address. Every text box must have a label. If the field is required, show an asterisk (*) next to the label.
You can include optional guidance text to help users understand what to enter. If the guidance is longer than a short sentence, use a guidance accordion instead.
Do:
use a text box only for single-line input. For longer text, use a Text area
choose a text box size that suits the expected content
always include a visible label that clearly describes what the user should enter
Avoid:
using a text box when users must choose from a set list of options – use a dropdown, select or radio button group instead
relying on placeholder text. It can be inaccessible to some users, may not meet contrast requirements, and can be mistaken for pre-filled content
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