Enhanced Snippets with more positional arguments

I remember it being possible in Kirby 2, but would it be possible in Kirby 4 do make own snippets like:

<?= heroicon("iconName", "variant", ["class" => "..."]) ?>
<?= fontawesome("iconName", "variant", ["class" => "..."]) ?>

~ Max

EDIT:
I would love to make the following a bit more ergonomic

Snippet: snippets/fontawesome.php

<?php
$path = $kirby->roots()->assets() . "/fontawesome-pro/svgs/";
$icon = $icon ?? "circle-exclamation";
$variant = $variant ?? "regular";

echo
str_replace(
  '<svg',
  sprintf('<svg %s', 'class="' . $class . '"'),
  svg("{$path}/{$variant}/{$icon}.svg")
);

Usage:

<?= snippet("fontawesome", ["icon" => "language", "class" => "h-5"]) ?>

Hm, I don’t really understand your question. These look like custom functions, that definitely didn’t exist in Kirby 2, either.

Maybe I’m completely mistaken …

But would it be possible to write a plugin that behaves like that? And if yes, would you mind guiding me to a starting point? I have no idea which Plugin Type that could be…

Simple functions like in your example aren’t Kirby extension types. You can simply add them to your plugin’s index.php

<?php

function xyz($argument) {
  // do stuff
}

Or you create a class with several such functions and load this class in your index.php.

See Plugin Basics | Kirby CMS