In this lesson, we will explore how to change the look of the page's main elements: the logo, colors, layout, and navigation.
Changing the App Name
Your application's default name at the top left, beside the logo, is "Laravel Starter Kit". You can change it in the logo component file.
resources/js/components/AppLogo.vue
BEFORE:
<span class="mb-0.5 truncate font-semibold leading-none">Laravel Starter Kit</span>
AFTER:
<span class="mb-0.5 truncate font-semibold leading-none">Vue Tasks</span>
Changing the Name COLOR
With the same example, let's change the color with Tailwind, adding a text-blue-800
class.
resources/js/components/AppLogo.vue
BEFORE:
<span class="mb-0.5 truncate font-semibold leading-none">Vue Tasks</span>
AFTER:
<span class="mb-0.5 truncate font-semibold leading-none text-blue-800">Vue Tasks</span>
Here's the visual result:
Notice: we're running npm run dev
in the background to re-compile CSS styles automatically after every change.
Changing the Logo Icon
The logo icon is SVG, so we can change it with any other SVG we want.
resources/js/components/AppLogoIcon.vue
BEFORE:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 42" :class="className" v-bind="$attrs"> <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M17.2 5.633 8.6.855 0 5.633v26.51l16.2 9 16.2-9v-8.442l7.6-4.223V9.856l-8.6-4.777-8.6 4.777V18.3l-5.6 3.111V5.633ZM38 18.301l-5.6 3.11v-6.157l5.6-3.11V18.3Zm-1.06-7.856-5.54 3.078-5.54-3.079 5.54-3.078 5.54 3.079ZM24.8 18.3v-6.157l5.6 3.111v6.158L24.8 18.3Zm-1 1.732 5.54 3.078-13.14 7.302-5.54-3.078 13.14-7.3v-.002Zm-16.2 7.89 7.6 4.222V38.3L2 30.966V7.92l5.6 3.111v16.892ZM8.6 9.3 3.06 6.222 8.6 3.143l5.54 3.08L8.6 9.3Zm21.8 15.51-13.2 7.334V38.3l13.2-7.334v-6.156ZM9.6 11.034l5.6-3.11v14.6l-5.6 3.11v-14.6Z" /></svg>
AFTER:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 32" :class="className" v-bind="$attrs"> <path d="M7.015 25.238V0H0v32h12.303c7.387 0 12.223-2.902 14.854-7.028l-14.854.266H7.015Z" fill="#fff" /> <path d="M13.95 6.416h2.445c4.384 0 7.44 3.168 7.44 8.146 0 1.278-.212 2.423-.558 3.435h6.351c.24-1.092.372-2.237.372-3.435C30 6.336 24.128.027 16.422.027h-2.445l-.027 6.389Z" fill="#fff" /></svg>
Visual result:
Changing the Logo Color
There are two different component files: AppLogoIcon.vue
and AppLogo.vue
. We can change the Tailwind CSS color for the logo from text-white
to text-blue-100
and add a few CSS classes to the main div
.
resources/js/components/AppLogo.vue
BEFORE:
<template> <div class="flex aspect-square size-8 items-center justify-center rounded-md bg-sidebar-primary text-sidebar-primary-foreground"> <AppLogoIcon class="size-5 fill-current text-white dark:text-black" /> </div> <div class="ml-1 grid flex-1 text-left text-sm"> <span class="mb-0.5 truncate font-semibold leading-none text-blue-800">Vue Tasks</span> </div></template>
AFTER:
<template> <div class="flex aspect-square size-8 items-center justify-center rounded-md bg-gradient-to-b from-blue-500 to-blue-600"> <AppLogoIcon class="size-5 fill-current text-blue dark:text-black" /> </div> <div class="ml-1 grid flex-1 text-left text-sm"> <span class="mb-0.5 truncate font-semibold leading-none text-blue-800">Vue Tasks</span> </div></template>
Visual result:
The Tailwind structure we've used here is called Linear background gradient.
Changing Sidebar Active Color
Quite a few CSS styles are defined in the resources/css/app.css
file.
For example, let's change the styling of the active menu item.
resources/css/app.css
BEFORE:
:root { --sidebar-accent: 0 0% 94%;}
AFTER:
:root { --sidebar-accent: 224.55 100% 86% / 0.19;}
Visual result:
There's also a .dark
version below in the same file:
.dark { --sidebar-accent: 223.81 0% 15%;}
Notice: If you're not familiar with the hsl
color format, I suggest you read this article.
Changing from Sidebar to Topbar layout
Laravel starter kits allow us to easily change the navigation from the sidebar to the topbar. Two layouts are available, and you just need to change which one you're using.
resources/js/layouts/AppLayout.vue
BEFORE:
import AppLayout from '@/layouts/app/AppSidebarLayout.vue';
AFTER:
import AppLayout from '@/layouts/app/AppHeaderLayout.vue';
Visual result:
For the rest of this course, we will stay with the header layout and the navigation on top.
Changing TopBar Active Menu Item Color
The final change in this lesson is for the active menu item.
resources/js/components/AppHeader.vue
BEFORE:
<div v-if="isCurrentRoute(item.href)" class="absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-black dark:bg-white"></div>
AFTER:
<div v-if="isCurrentRoute(item.href)" class="absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-blue-600 dark:bg-white"></div>
And now we have a blue color for the active menu item:
These are just a few examples of customizations.
Here's the GitHub commit for these visual changes.
The main logic is this:
- You need to find the
.vue
component where the element is located - Figure out if there are options for different values on the JS side
- Be familiar with Tailwind to customize the styling
If you're new to Tailwind, we have a separate course called Tailwind CSS for Laravel Developers.
In the next lesson, we will move beyond the default starter kit and start building our own Laravel + Vue CRUD on top of it.
No comments yet…