Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default font in vuetify

I can't figure out how to change the default font in vuetify. I've been looking for the right variable within ./node_modules/vuetify, but I can't locate it.

I'd ideally not make any changes in the module, but would rather override such variables from outside the module.

like image 672
ba_ul Avatar asked Aug 09 '17 19:08

ba_ul


People also ask

How do I change Vuetify default font?

vuetify: { customVariables: ['~/assets/variables. scss'], treeShake: true }, Finally, in order to change body and header fonts, you need to set the $body-font-family, $heading-font-family, and $font-size-root variables in /assets/variables.

What font does Vuetify use?

Vuetify. js uses the Material Design spec Roboto Font. Each heading size also has a corresponding helper class to style other elements the same.

How do I change the text color in Vuetify?

Changing text color and background color is easy with Vuetify, too. For the background color, simply add the name of the required color to the element's class. For text color, just add the color name followed by --text .

Is Vuetify and Vue JS same?

Vuetify is a component framework for Vue. js 2. It aims to provide clean, semantic and reusable components that make building your application a breeze. Vuetify utilizes Google's Material Design design pattern, taking cues from other popular frameworks such as Materialize.


2 Answers

Best way

Define (if you use google fonts)

@import url('https://fonts.googleapis.com/css? family=Oxygen:300,400,700&display=swap'); @import url('https://fonts.googleapis.com/css? family=Comfortaa&display=swap');  $body-font-family: 'Oxygen'; $title-font: 'Comfortaa'; 

For vuetify 2+

.v-application {    font-family: $body-font-family, sans-serif !important;     .title { // To pin point specific classes of some components        font-family: $title-font, sans-serif !important;     }  } 

In app.vue or a separate scss/css file imported directly into app.vue

For vuetify 1.5.x In your app.vue script add

.application {   font-family: "Font Family Name"; } .headline, .title, .subheading{      font-family: $body-font-family !important; } 

For example, if you are using a google font, your script tag should look like

<style lang="scss"> @import url("https://fonts.googleapis.com/css?family=Questrial");  .application {   font-family: "Questrial"; } </style> 

Update 2021

In your main.scss file,

$font-family:'Ubuntu'  .v-application {   [class*='text-'] {     color: #36405a;     font-family: $font-family, sans-serif !important;   }   font-family: $font-family, sans-serif !important; } 
like image 100
Bhaskar Avatar answered Sep 28 '22 04:09

Bhaskar


The easiest way would be to simply set the font-family on body. If you are using webpack and importing the Vuetify stylus entry, main.styl, you can simply overwrite the $font-family variable with whatever font you want.

like image 23
John Leider Avatar answered Sep 28 '22 06:09

John Leider