Skip to content

Input

<ts-input> vv0.4.0

The ts-input component.

Open in Storybook for interactive demos.

<ts-input size="md"></ts-input>
PropertyAttributeTypeDefaultDescription
autocompleteautocompletestring | undefinedAutocomplete attribute.
disableddisabledbooleanfalseRenders the input as disabled.
errorerrorstring | undefinedRenders the input in an error state with an error message.
helpTexthelp-textstring | undefinedHelp text displayed below the input.
labellabelstring | undefinedLabel text displayed above the input.
maxlengthmaxlengthnumber | undefinedMaximum character length.
minlengthminlengthnumber | undefinedMinimum character length.
namenamestring | undefinedName attribute for form submission.
patternpatternstring | undefinedPattern for validation (regex string).
placeholderplaceholderstring | undefinedPlaceholder text.
readonlyreadonlybooleanfalseRenders the input as readonly.
requiredrequiredbooleanfalseMakes the input required.
sizesize"lg" | "md" | "sm" | "xl" | "xs"'md'The input’s size.
typetype"email" | "number" | "password" | "search" | "tel" | "text" | "url"'text'The input type.
valuevaluestring''The input’s value.
EventDetailBubblesComposedDescription
tsBlurvoidYesYesEmitted when the input loses focus.
tsChangeTsChangeEventDetail<string>YesYesEmitted when the value changes (on blur / commit).
tsFocusvoidYesYesEmitted when the input gains focus.
tsInputTsChangeEventDetail<string>YesYesEmitted when the value changes (on input).
tsValidateTsValidationEventDetailYesYesEmitted on validation.
MethodSignatureDescription
selectTextselectText() => Promise<void>Programmatically select the input text.
setFocussetFocus() => Promise<void>Programmatically focus the input.
NameDescription
help-textHelp text displayed below the input.
prefixContent before the input (e.g., icon or currency symbol).
suffixContent after the input (e.g., icon or clear button).

Use ::part() to style internal elements:

PartDescription
baseThe outer wrapper.
error-textThe error message wrapper.
help-textThe help text wrapper.
inputThe native input element.
labelThe label element.
prefixThe prefix slot wrapper.
suffixThe suffix slot wrapper.
ts-input::part(base) {
/* your custom styles */
}
<ts-input size="md"></ts-input>
import { TsInput } from '@tessera-ui/react';
<TsInput size="md"></TsInput>