Input (Textfield)     

Quasar’s Input component is the basis for text (we’ll call it “Singe Line Input”) and textarea (we’ll call it “Multiple Line Input”) form input. It can be used for regular text input, passwords, email addresses, numbers, telephone numbers, urls and auto-growing text areas.

Works well with QField for additional functionality such as a helper, error message placeholder and many others.

Basic Usage

<!-- Single Line Input -->
<q-input v-model="text" />
<q-input v-model="text" stack-label="Stack Label" />
<q-input v-model="text" float-label="Float Label" placeholder="Gigi" />

<!-- Multiple Line Input -->

Vue Properties

Supports v-model which should be bound to a String or Number (depending on type property used) in your scope.

typeStringMust be one of the following: text (default), textarea, email, tel, file, number, password and url. This is important as it determines the keyboard type popping up on mobile devices.
clearableBooleanIf set to true, the component offers the user an actionable icon to remove the entered text.
no-pass-toggleBooleanIf type is ‘password’ and set to true, then password toggle is not shown.
readonlyBooleanInput is readonly.
attributesObjectAdds HTML attributes to the enclosing <input> tag. Useful for browser autocomplete, as an example: :attributes="{autocompletetype: 'email', autocorrect: 'off'}"

When you set type to “number”, there are some additional properties that you can use:

minNumberMinimum number. It’s only enforced when user hits UP or DOWN keys. Don’t use only this property for validation.
maxNumberMaximum number. It’s only enforced when user hits UP or DOWN keys. Don’t use only this property for validation.
stepNumberDefault is 1. If Up or Down keys are used, this tells the increment amount.
max-decimalsNumberMaximum number of decimals that should be displayed.

When you set type to “textarea”, these are additional properties that you can use:

min-rowsNumberMinimum number of rows to display regardless of how many rows the content spans to.
max-heightNumberNumber in pixels that determines the maximum height of textarea which auto-grows.

Common input field properties:

autofocusBooleanFocus input field after rendering component.
placeholderStringA text to be shown on textfield, mainly to explain what should be entered.
nameStringAdds a “name” attribute to the input field.
max-lengthNumber/StringMaximum number of characters allowed on textual input field. This property only affects inputs with type text, textarea, email, tel, password and url
loadingBooleanPlace the default spinner of the theme after textfield to highlight some process takes place in the background.

Common input frame properties:

prefixStringA text that should be shown before the textfield.
suffixStringA text that should be shown after the textfield.
float-labelStringA text label that will “float” up above the input field, once the input field gets focus.
stack-labelStringA text label that will be shown above the input field and is static.
colorStringOne from Quasar Color Palette.
invertedBooleanInverted mode. Color is applied to background instead.
darkBooleanIs QInput rendered on a dark background?
alignStringOne of ‘left’, ‘center’ or ‘right’ which determines the text align within textfield.
disableBooleanIf set to true, textfield is disabled and the user cannot type anything.
readonlyBooleanIf set to true, textfield is readonly and the user cannot change value.
errorBooleanIf set to true, the input fields colors are changed to show there is an error.
warningBooleanSame as error, the input field color is changed to show there is a warning.
beforeArray of ObjectsIcon buttons on left side of textfield. Read below more details.
afterArray of ObjectsIcon buttons on right side of textfield. Read below more details.

Icon buttons

This section refers to before and after properties which can add additional buttons as icons to the textfield. Here is the structure of the two properties:

// required icon
icon: String,
// required function to call when
// icon is clicked/tapped
handler: Function,

// Optional. Show icon button
// if model has a value
content: Boolean,

// Optional. Show icon button
// if textfield is marked with error
error: Boolean


Show an icon button (with 'warning' as icon)
when there is an error on QInput (through "error" prop)
icon: 'warning',
error: true,
handler () {
// do something...

Show an icon button (with 'arrow_forward' as icon)
when the model has a non empty value
icon: 'arrow_forward',
content: true,
handler () {
// do something...


QInput comes with two built-in labeling possibilities. You can use the float-label or the stack-label properties to add text for the labeling of the field. A stack-label is static in its position above the field, whereas the fload-label is more dynamic. Check the examples to the right to see the difference.

<q-input v-model="text" stack-label="Stack Label" placeholder="Add some text..."  />
<q-input v-model="text" float-label="Float Label"/>

As shown above, you can also add a placeholder to help explain to the user what type of input should be entered.

Password Input

If you use the input type password, the component will hide the characters entered by the user, but it will also offer the user a clickable icon to toggle the input, to make the input legible.

<q-input v-model="text" type="password" float-label="Password" />

Number Input

The below example shows a number input type.

<q-input v-model="number" type="number" float-label="Number" />

Prefixes and Suffixes

You can add a text before or after the field as part of an input mask, for instance, for showing Euro or US Dollar currency.

<!-- Notice prefix property -->
<q-input v-model="number" type="number" prefix="$US" stack-label="Number" />

<!-- Notice suffix property -->
<q-input v-model="number" type="number" suffix="€" stack-label="Number" />

<!-- Notice suffix property -->
<q-input v-model="email" type="email" suffix="" stack-label="Type Google Email" />

Error State

You can control the color to show a mistake in user input or some other systematic error. To do this set the error prop to true.

<q-input :error="error" v-model="text" float-label="Colored Black" color="black" />

If you’d like to show the user an explanatory text about the error condition, you can wrap the QInput in a QField component.

Notice error prop is now used on wrapper QField
instead of on QInput now
<q-field :error="error" error-label="Oh buggers! You made a boo boo.">
<q-input v-model="text" float-label="Colored with Error" color="amber" />

Please refer to the QField documentation for more info about its usage.

Loading State

If, for some reason, the input requires some longer term background action or process, you can add a spinner to indicate progress by setting the loading prop to true.

<q-input :loading="loading" v-model="text" placeholder="Add some text..." />

Vue Methods

Vue MethodDescription
clear()Clear the model. Sets it to empty String ''.
togglePass()Applies to type “password” only. Toggles between showing legible password or not.
focus()Focused the textfield.
blur()Makes textfield lose focus.
select()Selects all textfield text and focuses.

Vue Events

Vue EventDescription
@change(newVal)Triggered on model value change.
@focusTriggered on focus.
@blurTriggered a blur.
@keydownTriggered by keydown event on textfield.
@keyupTriggered by keyup event on textfield.
@clickTriggered by a native click event on textfield.


It is possible to add formatting to a QInput in two ways. One is for the basic component. The other is with the QField component. Both methods offer “inverted” coloring.

Additional Vue Properties

colorStringThe color the QInput should have. The default is primary.
invertedBooleanSet to true, to color field’s background set by the color prop.
darkBooleanSet to true, if the field is on a dark background. It will invert the text color to make it light.
alignTextControls the ‘right’, ‘center’ or ‘left’ alignment of the input. The default is ‘left’.

Basic Formatting Examples

This will color the field black.

<q-input v-model="text" float-label="Colored" color="black" />

This will show an inverted colored input field in amber. Here, the text is automatically inverted to a lighter color.

<q-input v-model="text" inverted color="amber" stack-label="Amber Colored Background" />


You can also align the input to the right, center or left. The default is left. The below example will show a field for Euro currency input.

<!-- Align textfield content to the right -->
<q-input v-model="number" align="right" type="number" suffix="€" stack-label="Number" />

Basic Usage with QField

It is also possible to further enhance a QInput by wrapping it in a QField component.

<div class="bg-grey-9" style="width: 500px; padding: 25px">
label="Some Label"
helper="Some helper"
error-label="Some error"

The above usage of QField will show the input field within a dark grey background with an inverse white text. Notice the usage of the dark prop for QInput. This controls the inversion of the text color.

Please refer to the QField documentation for more info about its usage.

Validations with Vuelidate

Quasar’s recommendation for doing form components validations is Vuelidate as it fits great with the overall architecture. It’s simple, lightweight and model-based.


import { required, email } from 'vuelidate/lib/validators'

export default {
data () {
return {
email: ''
validations: {
email: { required, email }

For more options like displaying an error label, a helper or character counter, wrap QInput with a QField. Here is a more involved example.

Directive Modifiers for v-model

Vue comes with standard modifiers on v-model, which can be useful in conjunction with QInput. They are .lazy and .trim.


By default, v-model syncs the input with the data after each input event. You can add the lazy modifier to instead sync after change events:

<!-- synced after "change" instead of "input" -->
<q-input v-model.lazy="msg">


If you want the user’s input to be trimmed automatically, you can add the trim modifier to your v-model managed inputs:

<q-input v-model.trim="msg">