Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify icon size

recently I was working on an app using Vuetify and had trouble to change the Vuetify default colors. So I finally ended with this:

https://github.com/vuetifyjs/vuetify/issues/299

Which as its says, I added the following code:

 <style lang="stylus">
  @require '../node_modules/vuetify/src/stylus/settings/_colors.styl'
  $theme := {
    primary: #009688
    accent: #FFC107
    secondary: #00796B
    info: #B2DFDB
    warning: $red.base
    error: $red.base
    success: $green.base
  }
  @require '../node_modules/vuetify/src/stylus/main.styl'
</style>

In App.vue

So when I tested changing colors in the app, it worked as expected, so far so good. Then I noticed that it changed the size of the icons, as pictured below:

Before

After

So, my question is:

Is there a way to solve this problem by not using CSS? If so, how? Or if there's no way, then, how should I solve it using CSS?

like image 904
Eternal_N00B Avatar asked Jan 05 '18 18:01

Eternal_N00B


People also ask

How do I change my Vuetify icon?

The v-icon component provides a large set of glyphs to provide context to various aspects of your application. For a list of all available icons, visit the official Material Design Icons page. To use any of these icons simply use the mdi- prefix followed by the icon name.

Is Vuetify easy?

Unlike other frameworks, Vuetify is designed from the ground up to be easy to learn and rewarding to master with hundreds of carefully crafted components from the Material Design specification .

Is Vuetify customizable?

Customizing. By default, Vuetify has a standard theme applied for all components. This can be easily changed. Simply pass a theme property to the Vuetify constructor.


2 Answers

You can give icon size in px using size property in Vuetify icons.

<v-icon size="25">home</v-icon>

Or you can use x-small, small, medium, large and x-large in v-icon tag e.g.

<v-icon small >home</v-icon>
like image 181
Isuru Chandrasiri Avatar answered Sep 17 '22 14:09

Isuru Chandrasiri


Unfortunately in the current version (0.17.6) you will need css to create a custom icon size.

If you wanted to set a custom default size of your icons across your app you will need to target it will css.

To target icons size you can use the following:

.icon {
  font-size: 20px;
}

If you are using Vuetify v1.0.0-alpha.1 or later, <v-icon> component has a size attribute which you can use to set an exact size.

like image 37
James Vansteenkiste Avatar answered Sep 16 '22 14:09

James Vansteenkiste