Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change <v-text-field> icon's color?

In my <v-toolbar> component, I want to set a text field search with the icon search prepended:

<v-text-field                                                                                                                                  
    solo-inverted                                                                                                                                                        
    prepend-icon="search"                                                                                                                                                
    label="Search"                                                                                                                                                       
    class="hidden-sm-and-down"                                                                                                                                           
    >                                                                                                                                                                    
</v-text-field> 

This works but it gives me this result I do not like:

enter image description here

I do not like it because I want both the text field and icon in white color, so I added the property background-color="white" to the previous code:

<v-text-field                                                                                                                                                          
    background-color="white"                                                                                                                                             
    solo-inverted                                                                                                                                                        
    prepend-icon="search"                                                                                                                                                
    label="Search"                                                                                                                                                       
    class="hidden-sm-and-down"                                                                                                                                           
    >                                                                                                                                                                    
</v-text-field> 

This gives me half of what I want:

enter image description here

How can change the color of that icon into white?

I did some search on Vuetify.js API but could not see an appropriate option there.

like image 814
Billal Begueradj Avatar asked Sep 11 '18 07:09

Billal Begueradj


2 Answers

Had a similar problem. So I show as example the color-picker with vuetify

<v-menu
    v-model="menu"
    :close-on-content-click="false"
    transition="scale-transition"
>
    <v-text-field
       slot="activator"
       v-model="newClass.color.hex"
       label="color"
       readonly
    >
       <v-icon slot="prepend" :color="newClass.color.hex">
          format_color_fill
       </v-icon>
    </v-text-field>
    <material-picker v-model="newClass.color" />
 </v-menu>
like image 94
Kirill Manakhov Avatar answered Oct 21 '22 16:10

Kirill Manakhov


You can override icon color by class

OR

You can use v-text-field class to override icon color, for example:

.hidden-sm-and-down .v-icon {
    color: white !important;
}
like image 41
Nika Kurashvili Avatar answered Oct 21 '22 16:10

Nika Kurashvili