Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Blade Ionicons Laravel Package

faisal50x/blade-ionicons

A Laravel Blade package for rendering Ionicons in your views. Use simple Blade components or directives to add crisp, customizable SVG icons, with configurable options for size, color, and more—keeping icon usage clean and lightweight.

View on GitHub
Deep Wiki
Context7

Getting Started

What it is: foysal50x/blade-ionicons wraps the Ionicons SVG set in Blade components so you can drop icons into templates without hand-copying SVG markup or wiring an icon-font CDN.

Install and confirm the tag name:

composer require foysal50x/blade-ionicons

Then open vendor/foysal50x/blade-ionicons/README.md (or its service provider) and note two things before writing any markup:

  1. The exact component tag (it is rendered as <x-ionicon name="..." /> — confirm it hasn't been aliased in your app).
  2. The accepted name values. Ionicons ships three families (outline, solid, sharp) and names are suffixed accordingly (home, home-outline, home-sharp). Check whether the package resolves the suffix from config or expects the full name.

First use case: replace your hand-rolled icon partials in a layout/nav first — that's where you get immediate payoff:

<x-ionicon name="home-outline" class="w-5 h-5 text-gray-500" />

Because it renders inline <svg>, text-* and currentColor work for free, so a single component covers hover/active states without duplicating assets.

Minimum sanity check: render one icon, view source, and confirm the SVG is actually inline (not an <img> or background-image). That single check tells you whether CSS color/stroke overrides will behave.

Implementation Patterns

Wrap it once, use everywhere. Don't sprinkle the package tag through 200 views. Create a thin app-level component that fixes defaults (size, stroke width, accessibility) and delegates:

{{-- resources/views/components/icon.blade.php --}}
@props(['name', 'size' => 'w-5 h-5'])
<x-ionicon :name="$name" {{ $attributes->class([$size]) }} aria-hidden="true" />

Now swapping the underlying icon set later is a one-file change instead of a grep-and-replace across the codebase.

Semantic aliases for domain concepts. Map product language to icon names in one place rather than remembering Ionicons naming in every view:

// config/icons.php
return [
    'invoice'  => 'document-text-outline',
    'customer' => 'person-circle-outline',
    'alert'    => 'warning-outline',
];
<x-icon :name="config('icons.invoice')" />

Pair with nav/button components, not raw usage. The common integration is inside a nav-link or button Blade component where the icon sits beside a label; pass the icon name as a prop so the component owns alignment (flex items-center gap-2) and you never fight spacing per-instance.

Status/state mapping. For dashboards, drive the icon from an enum or model state via a match in a small helper — cleaner than Blade @if ladders and much easier to keep visually consistent:

<x-icon :name="match($order->status) {
    'paid'    => 'checkmark-circle',
    'pending' => 'time-outline',
    default   => 'ellipse-outline',
}" />

Testing. Assert on the rendered SVG content rather than the tag, so refactors inside your wrapper don't break tests:

$this->get('/')->assertSee('svg', false);

For component-level tests, Blade::render('<x-icon name="home" />') and assert the expected path/class is present.

Gotchas and Tips

Laravel 13 support is the v1.2.0 change — and it's a constraint widening, not a rewrite. The PR relaxes/extents the illuminate/support requirement so the package installs alongside Laravel 13. Practical implications:

  • This is a low-risk, non-breaking release. No API, config, or view changes are implied by the notes.
  • If you were previously pinned to v1.1.0 because Composer refused to resolve against a newer Laravel, re-run composer update foysal50x/blade-ionicons (or composer require foysal50x/blade-ionicons:^1.2) after confirming your php constraint satisfies Laravel 13's minimum (8.3+).
  • Verify in CI on the actual matrix you deploy, not just locally — a passing install is not proof the component renders on the new framework version.

Name resolution is the #1 source of "blank icon" bugs. Ionicons names are not guesses: home exists, home-outline exists, house does not. A missing name typically renders an empty <svg> (or nothing) rather than throwing — so the failure is silent and looks like a CSS sizing problem. When an icon doesn't appear, inspect the DOM first: if the <svg> has no <path>, it's a name problem, not a styling one.

Outline vs solid need different stroke handling. Outline icons are stroke-based; solid icons are fill-based. Applying stroke-width to a solid icon does nothing, and fill-current on an outline icon can fill it into a blob. Set color with currentColor/text-* and reserve stroke-* utilities for outline families only.

Config and view caching. If the package exposes a publishable config (php artisan vendor:publish --tag=...), remember config:cache in production freezes it — a deploy that changes icon config without re-caching will serve stale values. Same for compiled Blade views after a wrapper-component change.

Attribute merging. $attributes on a Blade component merges classes by default, but a class passed to the package's own component may not merge with an internal default the way you expect. If your w-5 is being overridden by the package's width="..." SVG attribute, prefer passing class through your wrapper and letting CSS win via utility specificity rather than editing vendor files.

Inline SVG has bundle/render trade-offs. Every icon inlines its full markup. That's ideal for color theming and small counts, but if you render hundreds of icons in one view (data tables, long lists), you're inflating HTML payload. For that case, consider a sprite or caching the icon markup in a partial.

Accessibility is on you. Decorative icons should be aria-hidden="true"; meaningful ones need role="img" plus <title> or an adjacent sr-only label. Bake this into your wrapper component so you can't forget it per-instance.

Extension points to prefer over forking: your own wrapper component, a published config alias map, and CSS custom properties for size/color. Forking the package to change one icon means re-doing the work at every upstream release — and this package is actively receiving version-bump releases.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console