Logo

Single line

<v-form>
  <v-container>
    <v-row>

      <v-col cols="12" sm="6">
        <v-text-field
          label="Regular"
          single-line
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          label="Solo"
          single-line
          solo
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          label="Filled"
          single-line
          filled
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          label="Outlined"
          single-line
          outlined
        ></v-text-field>
      </v-col>

    </v-row>
  </v-container>
</v-form>

Single line text fields do not float their label on focus or with data.

Character counter

<v-form>
  <v-container>
    <v-row>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="title"
          :rules="rules"
          counter="25"
          hint="This field uses counter prop"
          label="Regular"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="description"
          :rules="rules"
          counter
          maxlength="25"
          hint="This field uses maxlength attribute"
          label="Limit exceeded"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="title"
          :rules="rules"
          counter="25"
          filled
          label="Filled"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="title"
          :rules="rules"
          counter="25"
          label="Outlined"
          outlined
        ></v-text-field>
      </v-col>

    </v-row>
  </v-container>
</v-form>

Use a counter prop to inform a user of the character limit. The counter does not perform any validation by itself. You will need to pair it with either the internal validation system, or a 3rd party library. You can use it on regular, box or outlined text fields.

18 / 25
50 / 25
18 / 25
18 / 25

Password input

<v-form>
  <v-container fluid>
    <v-row>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="password"
          :append-icon="show1 ? 'mdi-eye' : 'mdi-eye-off'"
          :rules="[rules.required, rules.min]"
          :type="show1 ? 'text' : 'password'"
          name="input-10-1"
          label="Normal with hint text"
          hint="At least 8 characters"
          counter
          @click:append="show1 = !show1"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          :append-icon="show2 ? 'mdi-eye' : 'mdi-eye-off'"
          :rules="[rules.required, rules.min]"
          :type="show2 ? 'text' : 'password'"
          name="input-10-2"
          label="Visible"
          hint="At least 8 characters"
          value="wqfasds"
          class="input-group--focused"
          @click:append="show2 = !show2"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          :append-icon="show3 ? 'mdi-eye' : 'mdi-eye-off'"
          :rules="[rules.required, rules.min]"
          :type="show3 ? 'text' : 'password'"
          name="input-10-2"
          label="Not visible"
          hint="At least 8 characters"
          value="wqfasds"
          class="input-group--focused"
          @click:append="show3 = !show3"
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          :append-icon="show4 ? 'mdi-eye' : 'mdi-eye-off'"
          :rules="[rules.required, rules.emailMatch]"
          :type="show4 ? 'text' : 'password'"
          name="input-10-2"
          label="Error"
          hint="At least 8 characters"
          value="Pa"
          error
          @click:append="show4 = !show4"
        ></v-text-field>
      </v-col>

    </v-row>
  </v-container>
</v-form>

A password input can be used with an appended icon and callback to control the visibility.

8

Clearable

<v-form>
  <v-container>
    <v-row>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="message1"
          label="Regular"
          clearable
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="message2"
          solo
          label="Solo"
          clearable
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="message3"
          filled
          label="Filled"
          clearable
        ></v-text-field>
      </v-col>

      <v-col cols="12" sm="6">
        <v-text-field
          v-model="message4"
          label="Outlined"
          outlined
          clearable
        ></v-text-field>
      </v-col>

    </v-row>
  </v-container>
</v-form>

When clearable, you can customize the clear icon with clear-icon.

Auto hiding details

<div>
  <v-text-field label="Main input" :rules="rules" hide-details="auto"></v-text-field>
  <v-text-field label="Another input"></v-text-field>
</div>

When hide-details is set to auto messages will be rendered only if there's a message (hint, error message, counter value etc) to display.

Custom colors

<v-card flat>
  <v-snackbar
    v-model="snackbar"
    absolute
    top
    right
    color="success"
  >
    <span>Registration successful!</span>
    <v-icon dark>mdi-checkbox-marked-circle</v-icon>
  </v-snackbar>
  <v-form ref="form" @submit.prevent="submit">
    <v-container fluid>
      <v-row>
        <v-col cols="12" sm="6">
          <v-text-field
            v-model="form.first"
            :rules="rules.name"
            color="purple darken-2"
            label="First name"
            required
          ></v-text-field>
        </v-col>
        <v-col cols="12" sm="6">
          <v-text-field
            v-model="form.last"
            :rules="rules.name"
            color="blue darken-2"
            label="Last name"
            required
          ></v-text-field>
        </v-col>
        <v-col cols="12">
          <v-textarea
            v-model="form.bio"
            color="teal"
          >
            <template v-slot:label>
              <div>
                Bio <small>(optional)</small>
              </div>
            </template>
          </v-textarea>
        </v-col>
        <v-col cols="12" sm="6">
          <v-select
            v-model="form.favoriteAnimal"
            :items="animals"
            :rules="rules.animal"
            color="pink"
            label="Favorite animal"
            required
          ></v-select>
        </v-col>
        <v-col cols="12" sm="6">
          <v-slider
            v-model="form.age"
            :rules="rules.age"
            color="orange"
            label="Age"
            hint="Be honest"
            min="1"
            max="100"
            thumb-label
          ></v-slider>
        </v-col>
        <v-col cols="12">
          <v-checkbox
            v-model="form.terms"
            color="green"
          >
            <template v-slot:label>
              <div @click.stop="">
                Do you accept the
                <a href="javascript:;" @click.stop="terms = true">terms</a>
                and
                <a href="javascript:;" @click.stop="conditions = true">conditions?</a>
              </div>
            </template>
          </v-checkbox>
        </v-col>
      </v-row>
    </v-container>
    <v-card-actions>
      <v-btn text @click="resetForm">Cancel</v-btn>
      <v-spacer></v-spacer>
      <v-btn
        :disabled="!formIsValid"
        text
        color="primary"
        type="submit"
      >Register</v-btn>
    </v-card-actions>
  </v-form>
  <v-dialog v-model="terms" width="70%">
    <v-card>
      <v-card-title class="title">Terms</v-card-title>
      <v-card-text v-for="n in 5" :key="n">
        {{ content }}
      </v-card-text>
      <v-card-actions>
        <v-spacer></v-spacer>
        <v-btn
          text
          color="purple"
          @click="terms = false"
        >Ok</v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
  <v-dialog v-model="conditions" width="70%">
    <v-card>
      <v-card-title class="title">Conditions</v-card-title>
      <v-card-text v-for="n in 5" :key="n">
        {{ content }}
      </v-card-text>
      <v-card-actions>
        <v-spacer></v-spacer>
        <v-btn
          text
          color="purple"
          @click="conditions = false"
        >Ok</v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</v-card>

You can optionally change a text field into any color in the Material design palette. Below is an example implementation of a custom form with validation.