Products · Components

Input

A one-line field for text, numbers, a phone number or a search.

Give it a label: a placeholder disappears once the person types.

Children: Nothing

Example

The Input component
view.dml
<Input label="Phone number" type="phone" prefix="+232" placeholder="76 123456" value="{{ phone }}" onChange="setPhone" />
controller.ts
export default definePage({
  initialState: { phone: '' },
  mutations: {
    setPhone: (_state, event: ValueEvent) => ({ phone: event.detail.value }),
  },
});

Props

PropTypeWhat it is
valuestring
placeholderstring
labelstring
hintstringHelp shown under the field, which error replaces.
errorstringShown under the field in red, in place of hint.
prefixstringText inside the field before what the person types, such as +232.
suffixstringText inside the field after what the person types, such as kg.
typetext, number, email, phone, password, searchsearch shows a search icon and a search key on the keyboard. Default: text.
clearablebooleanShows a button that empties the field once it has text.
maxLengthnumber
disabledbooleanDims it, and the person can't use it.

Events

EventSendsNotes
onChange{ value } in detail
onSubmit{ value } in detailWhen the person presses the keyboard's submit key.

Keep reading

On this page