diff --git a/changelog.md b/changelog.md
index f41c5e8..e5cb211 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+## [2.1.0] - 2020-12-05
+
+- Allow to specify icon classes as array
+
## [2.0.1] - 2020-12-05
- Remove fill color defined on some icons in action, av, content, editor and navigation groups
diff --git a/src/MaterialIconsBridgeFactory.php b/src/MaterialIconsBridgeFactory.php
index 4c0890e..076a979 100644
--- a/src/MaterialIconsBridgeFactory.php
+++ b/src/MaterialIconsBridgeFactory.php
@@ -106,12 +106,20 @@ public function registerIconSets(): self
*
* @param string $set The icon set within Material UI icons (e.g. action)
* @param string $name The icon name (e.g. alarm)
- * @param string $class The eventual class tag to be applied. Default nothing
+ * @param string|array $class The eventual class tag to be applied. Default nothing
* @param array $attrs Other HTML attributes as an associative array
* @return \BladeUI\Icons\Svg the SVG to render the icon
*/
public function materialicon($set, $name, $class = '', $attrs = [])
{
+ if(is_array($class)){
+ if(isset($class['class'])){
+ $attrs = array_merge($attrs, Arr::except($class, 'class') ?? []);
+ }
+
+ $class = $class['class'] ?? implode(' ', $class ?? []);
+ }
+
$full_class = implode(" ", [$this->config['class'], $class]);
$prefixed_set = "materialicon_$set";
diff --git a/tests/MaterialIconsBridgeHelpersTest.php b/tests/MaterialIconsBridgeHelpersTest.php
index 985a1d5..21daee8 100644
--- a/tests/MaterialIconsBridgeHelpersTest.php
+++ b/tests/MaterialIconsBridgeHelpersTest.php
@@ -38,6 +38,20 @@ public function test_specifying_class_as_attribute_overrides_default_class()
$this->assertEquals($expected, $result);
}
+ public function test_specifying_class_as_associative_array_is_supported()
+ {
+ $result = materialicon('action', 'accessibility', ['class' => 'overridden'])->toHtml();
+ $expected = '';
+ $this->assertEquals($expected, $result);
+ }
+
+ public function test_specifying_class_as_array_is_supported()
+ {
+ $result = materialicon('action', 'accessibility', ['overridden', 'additional'])->toHtml();
+ $expected = '';
+ $this->assertEquals($expected, $result);
+ }
+
public function test_materialicon_helper()
{
$result = materialicon('action', 'accessibility')->toHtml();