Laravel Nova change font family

Viewed 2143

Anyone knows how can i change the default Nunito font with the Roboto Font in Laravel Nova app? I can not see anything in documentation Thanks

2 Answers

You can add a custom css file to your nova app adding this in the boot method of your NovaServiceProvider.php

Nova::theme('link/to/your/file.css');

There are possible 2 ways, that I know. First is to create custom tool and override font-family. This would load both default Nunito and Roboto fonts.

Another way, which I preferer is to override layout.blade.php file. Create /resources/views/vendor/nova/layout.blade.php file, and copy contents of original nova layout. Then you can change font as you want.

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full font-sans antialiased">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=1280">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ \Laravel\Nova\Nova::name() }}</title>

    <!-- Change here to Roboto -->
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,800,800i,900,900i" rel="stylesheet">

This should be enough, but if not. Then add styles too, something like:

body {
  font-family: Roboto;
}

Keep in mind to update your layout, when upgrading nova

Related