DEV Community

Cover image for Customize the Laravel notifications template.
Ariel Mejia
Ariel Mejia

Posted on

6 3

Customize the Laravel notifications template.

This is a little tip but very helpful to customize the notifications layout the Laravel docs explain this command:

php artisan vendor:publish --tag=laravel-notifications
Enter fullscreen mode Exit fullscreen mode

Now in "resources/views/vendor" you can edit the markdown template layout.

But what if I need to customize the colors and other CSS of the template, well Laravel provides a command to publish this assets:

php artisan vendor:publish --tag=laravel-mail
Enter fullscreen mode Exit fullscreen mode

Now in "resources/views/vendor/mail/html/themes/default.css"

Here we can customize the CSS to brand the notifications.

Little tips:

  • To customize the header link:
.header a {
    color: #3d4852;
    font-size: 19px;
    font-weight: bold;
    text-decoration: none;
}
Enter fullscreen mode Exit fullscreen mode
  • To customize the button "primary":
.button-primary {
    background-color: #2d3748;
    border-bottom: 8px solid #2d3748;
    border-left: 18px solid #2d3748;
    border-right: 18px solid #2d3748;
    border-top: 8px solid #2d3748;
}
Enter fullscreen mode Exit fullscreen mode

Of course you can customize the error action and success action, just below.

Thanks for reading!

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more