tuix-input

Text, search, password and textarea fields with a floating label.

One element covers four field types. The label floats above the value once the field has content or focus, and the helper line below carries a state icon.

Loading the components…

Types

Loading the components…

The password field brings its own show/hide eye, with no property and no event.

Loading the components…

A textarea with maxlength also shows a character counter.

ValueAttributeRenders
InputType.TEXTtextA single-line field, with iconRight if set
InputType.SEARCHsearchA single-line field with a leading search icon
InputType.PASSWORDpasswordA masked field with a built-in show/hide eye icon
InputType.TEXT_AREAtextareaA multi-line field, with a counter when maxlength is set

Description states

descriptionType picks the icon and the colour of the helper line, and tints the field itself. With anything other than text the icon and a default label appear even when description is empty.

Loading the components…
ValueAttributeIconColour
DescriptionType.TEXTtextnoneMuted; shown only when description is set
DescriptionType.WARNINGwarningtriangle-exclamationVALIDATION
DescriptionType.ERRORerrorcircle-xERROR
DescriptionType.SUCCESSsuccesscircle-checkSUCCESS
DescriptionType.LOADINGloadingloaderPRIMARY_300

States

Loading the components…

Events

Typing in the field shows what the handlers receive:

Loading the components…
input.addEventListener('on-change', (event) => setValue(event.detail.value))

The component does not own its value. on-change reports what was typed; the value only changes if the application writes it back to value.

API

Properties

PropertyAttributeTypeDefaultDescription
valuevaluestring''The field value
titletitlestring''Floating label
placeholderplaceholderstring''Placeholder text
typetypeInputTypetexttext, search, password or textarea
iconRighticonrightIconNameNoneTrailing icon, text only
maxlengthmaxlengthnumberNoneCharacter limit. On a textarea it also shows a counter
descriptiondescriptionstringNoneHelper text under the field
descriptionTypedescriptiontypeDescriptionTypetextWhich state the helper line shows
disableddisabledbooleanfalseBlocks input and events
readonlyreadonlybooleanfalseValue shown but not editable
autofocusautofocusbooleanfalseFocus the field once rendered, unless disabled or readonly
darkdarkbooleanfalseDark palette

Events

EventDetailWhen
on-change{ value: string }On every keystroke (the native input)
on-blur{ value: string }The field loses focus
on-clickNoneThe field is clicked and not disabled

Notes

  • iconRight is drawn on a text field only. A password field puts its own show/hide eye in that position and ignores iconRight, though it still reserves the space for one; search and textarea ignore it outright.
  • title is also the global HTML attribute, so setting it in plain HTML gives the host a native browser tooltip as well. Frameworks that set it as a property, including the React wrapper, do not.
  • The floating label needs the field to have a placeholder; the component falls back to a single space so the label animates correctly.
  • The textarea counter reads value.length, so it stays right when the value is set from outside.
  • The host is inline: it needs a container with a width, as every example above gives it.

On this page