1

What's the best way to integrate Tailwindcss Heroicions into Laravel 9?

This is my workflow. I created a "symbols" folder in my Laravel file structure:

resources > views > components > symbols

Then I download and save each SVG file: arrow-down.blade.php.

In the SVG blade file I empty the class attribute and replace it with {{ $class }}:

<svg xmlns="http://www.w3.org/2000/svg" class="{{ $class }}">
  <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" />
</svg>

And integrate it like this:

<x-symbols.star class="w-6 h-6"/>

Is there a better way? Can I download Heroicons as Blade files so I don't have to do this manual work?

bart
  • 14,958
  • 21
  • 75
  • 105

0 Answers0