Components

Icon

Basics

The Icon component is used for rendering icons.

use MoonShine\Support\Enums\Color;
 
make(
string $icon,
int $size = 5,
Color|string $color = '',
?string $path = null,
)
use MoonShine\Support\Enums\Color;
 
make(
string $icon,
int $size = 5,
Color|string $color = '',
?string $path = null,
)
  • $icon - name of the icon or HTML (if custom mode is used),
  • $size - size,
  • $color - color,
  • $path - path to the directory where the Blade templates for icons are located.
use MoonShine\UI\Components\Icon;
 
Icon::make('users')
use MoonShine\UI\Components\Icon;
 
Icon::make('users')
<x-moonshine::icon icon="users" />
<x-moonshine::icon icon="users" />

Custom Output

Example with passing an HTML icon:

Icon::make(
svg('path-to-icon-pack')->toHtml()
)->custom()
Icon::make(
svg('path-to-icon-pack')->toHtml()
)->custom()