Appending multiple icons to inputs in Vuetify.js

Viewed 15152

I know how to use the append-icon property to append an icon at the end of an input like this:

new Vue({
  el: '#app'
})
<link href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/vuetify@1.3.8/dist/vuetify.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@1.3.8/dist/vuetify.min.js"></script>

<div id="app">
  <v-text-field
            label="Answer (optional)"
            append-icon="fas fa-times"
            @click:append="$emit('remove-answer')"
    ></v-text-field>
</div>

But is there any way to append multiple icons or buttons like you can in Bootstrap?

I'd like to add a few icons with different actions, but I haven't been able to find a solution so far...

2 Answers

You can use slots append or append-outer, you can add whatever you want in there.

v-text-field label="Answer (optional)">
  <template slot="append">
    <v-icon>clear</v-icon>
    <v-icon>search</v-icon>
  </template>
</v-text-field>

Codepen

Those who want to add single icon in textfield

just add append-icon attribute

<v-text-field
        v-model="search"
        append-icon="mdi-magnify"
        label="Search"
        single-line
        hide-details
></v-text-field>

Those who want to add multiple icons

Add template tag in textfield

<template slot="append">
    <v-icon>mdi-find</v-icon>
    <v-icon>mdi-key</v-icon>
   
  </template>
Related