diff --git a/src/Widget/Icon.php b/src/Widget/Icon.php index 5c2617f0..195c9fe7 100644 --- a/src/Widget/Icon.php +++ b/src/Widget/Icon.php @@ -4,6 +4,7 @@ use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; +use ipl\Stdlib\Str; /** * Icon element @@ -30,9 +31,13 @@ class Icon extends BaseHtmlElement */ public function __construct(string $name, $attributes = null) { + if (! Str::startsWith($name, 'fa-')) { + $name = "fa-$name"; + } + $this ->getAttributes() - ->add('class', ['icon', "fa-$name"]) + ->add('class', ['icon', $name]) ->add($attributes); }