Skip to content

TextField

The text-field component.

  • Import
    import "@tapsioss/web-components/text-field";
  • Tag
    <tapsi-text-field></tapsi-text-field>

Properties

NameDescriptionTypeDefault Value
valueThe current value of the input. It is always a string.string""
nameThe HTML name to use in form submission.string""
disabledWhether or not the element is disabled.booleanfalse
requiredIndicates that the user must specify a value for the input before the owning form can be submitted and will render an error state when reportValidity() is invoked when value is empty. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/requiredbooleanfalse
maxlengthThe maximum number of characters a user can enter into the text input. Set to -1 for none. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlengthnumber-1
minlengthThe minimum number of characters a user can enter into the text input. Set to -1 for none. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlengthnumber-1
placeholderDefines the text displayed in the text input when it has no value. Provides a brief hint to the user as to the expected type of data that should be entered into the control. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholderstring""
readonlyIndicates whether or not a user should be able to edit the text input's value. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonlybooleanfalse
autocompleteDescribes what, if any, type of autocomplete functionality the input should provide. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocompletestring""
supporting-textConveys additional information below the text input, such as how it should be used.string""
errorGets or sets whether or not the text input is in a visually invalid state. This error state overrides the error state controlled by reportValidity().booleanfalse
error-textThe error message that replaces supporting text when error is true. If errorText is an empty string, then the supporting text will continue to show. This error message overrides the error message displayed by reportValidity().string""
labelThe label of the text input. - If the hideLabel property is true, the label will be hidden visually but still accessible to screen readers. - Otherwise, a visible label element will be rendered. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelstring""
labelledbyIdentifies the element (or elements) that labels the input. https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledbystring""
sizeThe size of the input."sm" | "md""md"
hide-labelWhether to hide the label or not.booleanfalse
roundedWhether the input is rounded or not.booleanfalse
no-active-borderWhether to show the active border around the input or not.booleanfalse
typeThe <input> type to use, defaults to "text". The type greatly changes how the text field behaves. Text fields support a limited number of <input> types: - text - email - number - password - search - tel - url See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types for more details on each input type.string"text"
maxDefines the greatest value in the range of permitted values. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxstring""
minDefines the most negative value in the range of permitted values. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minstring""
patternA regular expression that the text field's value must match to pass constraint validation. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#patternstring""
multipleIndicates that input accepts multiple email addresses. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiplebooleanfalse
stepReturns or sets the element's step attribute, which works with min and max to limit the increments at which a numeric or date-time value can be set. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#stepstring""

Slots

NameDescription
leading-iconthe leading icon slot of the text-area
trailingthe trailing slot of the text-area

TIP

You can use slot names as variables:

ts
import { Slots } from "@tapsioss/web-components/text-field";

console.log(Slots.LEADING_ICON); // "leading-icon"
console.log(Slots.TRAILING); // "trailing"