Mity Docs Mity Docs for Mity Digital
Iconamic Documentation

Tag (manual use)

If you need to use Iconamic without a field, you can also manually pass the icon, path and path_helper parameters to the Iconamic tag.

Manually inject an icon

If you are not using a field to select an icon - maybe you're inferring the icon name from another variable or even a URL segment - you can still use Iconamic's SVG handling behaviour by manually injecting an icon.

Note that for most use cases, you'll probably use the fieldtype and standard tag behaviour.

You can pass the icon, path and path_helper parameters to the tag, and Iconamic will know what to do.

1<div class="w-8 h-8">
2 <!-- Inject the "/public/assets/path/my-icon.svg" file -->
3 {{ iconamic icon="my-icon" path="assets/path" path_helper="public_path" }}
4</div>

When using manual mode, you cannot use the handle method like you would when using a field.

icon

This is the only required parameter.

This is simply the name of the icon, with no file extension. If your file is my-icon.svg, then this value would be my-icon.

path

This is optional, but most likely required. This will be the path from your path_helper to the icon file.

path_helper

This is optional. If missing, Iconamic will use your configuration's default path_helper. Refer to the configuration for further details.

If you are providing this, you can supply one of:

  • app_path

  • base_path

  • public_path

  • resource_path

  • storage_path

Manually check if an icon exists

Iconamic's has helper still works when using the tag manually.

1<!-- Check if the icon exists -->
2{{ if {iconamic:has icon="my-icon" path="assets" path_helper="public_path" } }}
3 <!-- Output a wrapper -->
4 <div class="w-8 h-8">
5 <!-- Inject the icon -->
6 {{ iconamic icon="my-icon" path="assets" path_helper="public_path" }}
7 </div>
8{{ /if }}