- How do I install and use Lucide Icons in Laravel Blade views?
- Install via Composer with `composer require mallardduck/blade-lucide-icons`, then use Blade components like `<x-lucide-icon-name />` (e.g., `<x-lucide-home />`). No additional setup is needed for basic usage. For customization, pass classes or styles directly, like `<x-lucide-home class='w-8 h-8 text-blue-500' />`.
- Which Laravel and PHP versions are supported?
- This package requires **PHP 8.1+** and **Laravel 8.0+**. It’s fully compatible with Laravel 9/10 and PHP 8.2/8.3, as it leverages modern Blade components and Lucide’s stable API. Always check the [GitHub Actions badge](https://github.com/mallardduck/blade-lucide-icons/actions) for the latest compatibility.
- Can I customize the default size or attributes for all icons?
- Yes, publish the config file with `php artisan vendor:publish --tag=blade-lucide-icons-config` to set global defaults like `defaultClasses` or `defaultAttributes`. This mirrors Blade Icons’ configuration system, allowing consistent styling across your app without repeating props in every component.
- How do I use raw SVG files instead of Blade components?
- Publish the SVG assets with `php artisan vendor:publish --tag=blade-lucide-icons --force`, then reference them in Blade or static files using paths like `{{ asset('vendor/blade-lucide-icons/icon-name.svg') }}`. This is useful for non-Blade contexts or when you need direct SVG control.
- Will this package work with Livewire or Inertia.js?
- Blade components work natively in Livewire (e.g., `<x-lucide-icon wire:loading />`), but Inertia.js requires wrapping components in Inertia-compatible tags. For Inertia, use `<InertiaLink><x-lucide-icon /></InertiaLink>` or extract the SVG via raw assets if dynamic rendering is needed.
- Does this package support Lucide’s newest icons (e.g., v1.22.0) immediately?
- Yes, the package updates with Lucide’s minor releases (like v1.22.0) to include new icons without breaking changes. New icons are available instantly via their Blade component names (e.g., `<x-lucide-new-icon-name />`). Check the [Lucide changelog](https://github.com/lucide-icons/lucide/releases) for additions.
- How do I optimize performance with many icons?
- Enable Blade Icons caching via the config (`'cache' => true`) to reduce rendering overhead. For raw SVGs, lazy-load or tree-shake unused icons in your build process. The package itself adds negligible runtime cost, as it compiles SVGs to Blade components at build time.
- Are there alternatives to this package for Laravel?
- Other options include `blade-ui-kit/blade-heroicons` (for Heroicons) or `darkaonline/l5-svg` (for custom SVGs). However, this package is the most direct way to use Lucide Icons in Blade, offering tighter integration with Laravel’s ecosystem and Lucide’s modern, MIT-licensed icon set.
- How do I handle accessibility (ARIA labels, screen readers) for icons?
- Use `aria-hidden='true'` for decorative icons or add `aria-label` for interactive ones (e.g., `<x-lucide-search aria-label='Search' />`). For complex icons, pair them with text labels or use `role='img'` if needed. Lucide’s SVGs are semantic, but Blade components let you add context via attributes.
- Can I contribute new icons or fix issues in the package?
- Yes! Open a GitHub issue or pull request on [mallardduck/blade-lucide-icons](https://github.com/mallardduck/blade-lucide-icons). The package welcomes contributions, though new icons must align with Lucide’s governance. Check the [contributing guide](https://github.com/mallardduck/blade-lucide-icons/blob/main/CONTRIBUTING.md) for details.