Skip to content

Text Field Component

A text field component.

Properties

NameTypeDefaultDescription
valuestring''The value of the text field.
disabledbooleanfalseIndicates whether the text field is disabled.
errorbooleanfalseIndicates whether the text field has an error.
captionstring''The caption text for the text field.
labelstring''The label for the text field.
namestring''The name of the text field.
placeholderstring''The placeholder text for the text field.
inputmode'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'undefinedThe input mode for the text field.
type'text' | 'date' | 'month' | 'time' | 'week' | 'datetime-local' | 'number' | 'password' | 'search' | 'tel' | 'url' | 'email''text'The type of the text field.
autocompletestring''The autocomplete attribute for the text field.
maxnumberundefinedThe maximum value of the text field; only applying to text fields with these types: date, month, week, time, datetime-local, number.
minnumberundefinedThe minimum value of the text field; only applying to text fields with these types: date, month, week, time, datetime-local, number.
maxLengthnumberundefinedThe maximum length of the text field; only applying to text fields with these types: text, search, url, tel, email, password.
minLengthnumberundefinedThe minimum length of the text field; only applying to text fields with these types: text, search, url, tel, email, password.
patternstringundefinedThe allowed regex pattern of the text field; only applying to text fields with these types: text, search, url, tel, email, password.
stepnumberundefinedThe step of the text field; only applying to text fields with these types: date, month, week, time, datetime-local, number.

Slots

NameDescription
leadingthe leading slot of the text-field
trailingthe trailing slot of the text-field

CSS Parts

NameDescription
fieldThe main container for the text field.
labelThe label for the text field.
containerThe container for the input and any leading/trailing elements.
inputThe input element.
captionThe caption for the text field.
leadingThe leading for the text field.
trailingThe trailing for the text field.

Check this link to learn how to use CSS parts for Text Field Component.

CSS Properties

TokenDefaultDescription
--tap-font-family--tap-sys-font-familyThe font family used in the text field.
--tap-input-field-gap--tap-sys-spacing-4The gap between the elements in the text field.
--tap-input-label-color--tap-sys-color-content-primaryThe color of the label.
--tap-input-label-line-height--tap-sys-typography-label-sm-heightThe line height of the label.
--tap-input-label-font-size--tap-sys-typography-label-sm-sizeThe font size of the label.
--tap-input-label-font-weight--tap-sys-typography-label-sm-weightThe font weight of the label.
--tap-input-caption-color--tap-sys-color-content-tertiaryThe color of the caption.
--tap-input-caption-line-height--tap-sys-typography-body-sm-heightThe line height of the caption.
--tap-input-caption-font-size--tap-sys-typography-body-sm-sizeThe font size of the caption.
--tap-input-caption-font-weight--tap-sys-typography-body-sm-weightThe font weight of the caption.
--tap-input-container-height--tap-sys-spacing-11The height of the container.
--tap-input-container-padding--tap-sys-spacing-6The padding inside the container.
--tap-input-container-gap--tap-sys-spacing-4The gap between elements in the container.
--tap-input-container-background-color--tap-sys-color-surface-tertiaryThe background color of the container.
--tap-input-container-border-radius--tap-sys-radius-3The border radius of the container.
--tap-input-focus-background-color--tap-sys-color-surface-secondaryThe background color of the container when focused.
--tap-input-focus-border-width--tap-sys-color-border-inverse-primaryThe border width of the container when focused.
--tap-text-field-input-color--tap-sys-color-content-primaryThe color of the input text.
--tap-text-field-input-line-height--tap-sys-typography-body-md-heightThe line height of the input text.
--tap-text-field-input-font-size--tap-sys-typography-body-md-sizeThe font size of the input text.
--tap-text-field-input-font-weight--tap-sys-typography-body-md-weightThe font weight of the input text.
--tap-text-field-input-placeholder-color--tap-sys-color-content-tertiaryThe color of the placeholder text.
--tap-text-field-input-placeholder-line-height--tap-sys-typography-body-md-heightThe line height of the placeholder text.
--tap-text-field-input-placeholder-font-size--tap-sys-typography-body-md-sizeThe font size of the placeholder text.
--tap-text-field-input-placeholder-font-weight--tap-sys-typography-body-md-weightThe font weight of the placeholder text.
--tap-input-error-caption-color--tap-sys-color-content-negativeThe color of the caption when there is an error.
--tap-input-error-container-background-color--tap-sys-color-surface-negative-lightThe background color of the container when there is an error.
--tap-input-error-container-border-color--tap-sys-color-border-negativeThe border color of the container when there is an error.
--tap-input-disabled-container-background-color--tap-sys-color-surface-disabledThe background color of the container when disabled.
--tap-input-disabled-container-color--tap-sys-color-content-disabledThe color of the text and elements when disabled.
--tap-input-caret-color--tap-sys-color-surface-accentThe color of the input caret.