blade-ui-kit/blade-zondicons
Use Zondicons in Laravel Blade via simple SVG components powered by Blade Icons. Install with Composer, render icons like , and customize with classes/styles or config defaults. Optionally publish raw SVG assets and enable caching.
Installation:
composer require blade-ui-kit/blade-zondicons
First Use Case: Render a Zondicon in a Blade view:
<x-zondicon-cloud class="w-6 h-6 text-gray-500"/>
Where to Look First:
/resources/svg directory in the package for the full list of available icons.Component-Based Icons:
<x-zondicon-search class="text-blue-500"/>
class, style, id).Dynamic Icons with Variables:
@php
$icon = 'bell';
@endphp
<x-zondicon-{{ $icon }} class="w-5 h-5"/>
Consistent Styling with Config:
php artisan vendor:publish --tag=blade-zondicons-config
config/blade-zondicons.php:
'default_classes' => 'text-gray-600',
'default_attributes' => ['aria-hidden' => 'true'],
Raw SVG Assets:
php artisan vendor:publish --tag=blade-zondicons --force
<img src="{{ asset('vendor/blade-zondicons/heart.svg') }}" alt="Heart" width="20" height="20"/>
Integration with Tailwind CSS:
<x-zondicon-menu class="w-4 h-4 md:w-6 md:h-6 text-indigo-600 hover:text-indigo-800"/>
Icon Caching:
// config/blade-icons.php
'cache' => true,
Design System Integration:
resources/views/components/zondicon.blade.php.x-zondicon-alert-filled).Admin Panel Development:
<button>
<x-zondicon-edit class="mr-2"/>
Edit
</button>
Dark Mode Support:
document.body.classList.toggle('dark');
// Icons will inherit Tailwind dark mode classes (e.g., dark:text-white).
Localization:
<x-zondicon-globe class="mr-2"/>
{{ __('messages.welcome') }}
Laravel Mix/Webpack:
Inertia.js:
// Inertia response
return response()->inertia('Dashboard', {
icons: ['dashboard', 'settings'],
});
<!-- Dashboard.blade.php -->
<x-zondicon-{{ $icons[0] }} class="w-8 h-8"/>
Testing:
public function test_zondicon_component()
{
$this->blade('<x-zondicon-cloud/>')
->assertSee('<svg');
}
Custom Icons:
app/View/Components that wrap Zondicons:
// app/View/Components/CustomZondicon.php
class CustomZondicon extends Component
{
public $name;
public $classes = '';
public function render()
{
return view('components.custom-zondicon', [
'name' => $this->name,
'classes' => $this->classes,
]);
}
}
<!-- resources/views/components/custom-zondicon.blade.php -->
<x-zondicon-{{ $name }} {{ $classes }}/>
Icon Naming Conflicts:
zondicon-cloud), but Blade components are camelCase by default (x-zondicon-cloud). Stick to the package’s naming convention to avoid errors.Caching Issues:
php artisan view:clear
SVG Asset Paths:
public/vendor/blade-zondicons directory exists and is accessible. Misconfigured paths will break <img> references.Blade Component Registration:
Class 'Zondicon' not found errors, verify:
composer show blade-ui-kit/blade-zondicons).Dynamic Icon Names:
$allowedIcons = ['cloud', 'search', 'bell'];
if (in_array($userInput, $allowedIcons)) {
<x-zondicon-{{ $userInput }}/>
}
Missing Icons:
/resources/svg directory in the package for the icon’s SVG file. If missing, ensure you’re using the latest version (composer update blade-ui-kit/blade-zondicons).Styling Not Applying:
<svg> element.Performance Issues:
'cache' => true in config/blade-icons.php) to reduce compilation overhead.Configuration Overrides:
config/blade-zondicons.php).Icon Explorer:
Consistent Sizing:
'default_classes' => 'w-5 h-5',
Accessibility:
aria-hidden="true" via config or manually to non-interactive icons:
'default_attributes' => ['aria-hidden' => 'true'],
Dark Mode:
<x-zondicon-moon class="text-gray-500 dark:text-gray-300"/>
Custom Colors:
<x-zondicon-heart style="--zondicon-color: #ef4444"/>
(Note: Requires CSS custom properties support in the SVG.)Local Development:
public folder:
ln -s vendor/blade-ui-kit/blade-zondicons/resources/svg public/vendor/blade-zondicons
Extension Points:
public/vendor/blade-zondicons.Zondicon for reusable icon variants.Laravel 12+ Features:
<x-stack>
<x-zondicon-alert class="text-red-500"/>
<span>Notification</span>
</x-stack>
How can I help you explore Laravel packages today?