- How do I install Heroicons Blade Components in Laravel?
- Run `composer require archielite/laravel-heroicons` to install the package. No additional configuration is required unless you’re using SVG sprites, which may need publishing via `php artisan vendor:publish --tag=heroicons-assets`. The package registers Blade components automatically.
- What Laravel versions does this package support?
- The package is designed for Laravel 8.x and 9.x, leveraging Blade components. Check the package’s `composer.json` for exact version constraints, as newer Laravel releases may introduce breaking changes to Blade syntax.
- Can I use Heroicons dynamically (e.g., based on user roles)?
- Yes, you can conditionally render icons using Blade’s native syntax. For example, `@if(auth()->user()->isAdmin()) <x-heroicons::icon name='shield-check' /> @endif`. For complex dynamic cases, extend the component with slots or custom logic.
- Does this package work with Livewire or Alpine.js?
- The package is Blade-centric and doesn’t natively integrate with Livewire or Alpine.js. For dynamic frontend interactions, consider using Heroicons via Alpine.js or a JavaScript-based solution like `@heroicons/react`.
- How do I customize icon colors or sizes?
- Apply Tailwind CSS or custom classes directly to the Blade component, e.g., `<x-heroicons::icon name='user' class='text-red-500 w-6 h-6' />`. The package renders raw SVGs, so standard CSS styling applies.
- Will this package conflict with existing icon libraries like Font Awesome?
- No direct conflicts exist, but ensure your asset pipeline (e.g., Vite) doesn’t duplicate or misroute SVG files. If using SVG sprites, verify no naming collisions occur with other icon systems.
- Are there any performance concerns with using Blade components for icons?
- Minimal overhead exists since the package renders static SVGs. For large-scale apps, benchmark rendering times in Blade vs. client-side solutions (e.g., Alpine.js). Blade components are ideal for server-rendered views with low dynamic complexity.
- How do I handle missing or invalid icon names?
- The package doesn’t include built-in error handling for invalid icon names. Validate inputs manually (e.g., `if (in_array($name, Heroicons::validIcons()))`) or wrap components in `@error` directives to gracefully handle failures.
- Can I use Heroicons v1.x with this package?
- The package likely targets Heroicons v2.x, which is the current stable release. Migrating from v1.x may require updating icon names (e.g., `user-o` → `user`). Check the package’s `CHANGELOG.md` for version-specific notes.
- What’s the best way to test this package in a Laravel project?
- Test in a non-production Blade view by rendering icons with different names, sizes, and conditions. Use Laravel’s `assertSee` in feature tests to verify SVG output. For edge cases, mock Blade components or use `collective/html` for testing helpers.