Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Release: Change Requests 2.1.9 Minor update available for module change_requests (2.1.9). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Micon - Icomoon.io Icon packages for Drupal

1,125 sites Security covered Drupal 10–11
View on drupal.org

This module allows you to add IcoMoon icon packages to your Drupal site, making them available for use in CSS, HTML, and programmatically. It also offers integrations for adding icons to links, menus, paragraphs, vocabularies, content types, and local tasks.

Provides functionality for adding https://icomoon.io icon packages to Drupal and exposing them for use via CSS, HTML classes, and programmatically.

The module provides several submodules for integration into:

  • Micon Link: Provides an alternate widget & formatter for the link field that allows setting icons.
  • Micon Menu: Provides the ability to set icons for menu link content.
  • Micon Paragraphs: Provides the ability to set icons for paragraph bundles.
  • Micon Vocabulary: Provides the ability to set icons for taxonomy vocabularies.
  • Micon Content Type: Provides the ability to set icons for content types.
  • Micon Local Task: Provides automatic icon placement within the local task tab items.

Adding IcoMoon packages

Visit https://icomoon.io/app/#/select and create an icon package, by adding the desired icons to your Selection. Once finished, either click on Generate Font or Generate SVG & more to download the zip file provided by IcoMoon.

Go to `/admin/structure/micon` and follow these steps:

  1. Click the Add Micon Package button.
  2. Give your package a Name.

    Note: A class prefix is added automatically, but it is recommended to keep the class prefix as short as reasonably possible, as it is used in both CSS files and within the icon markup. The shorter it is, the smaller your rendered code and dependencies will be.

  3. Place the IcoMoon zip file you previously downloaded into the file upload field
  4. Click Save and you are done.

Published packages are immediately available for use site-wide.

Usage

Via CSS and HTML

The Micon admin interface provides an overview of all icons along with information on how to use them via CSS and raw HTML.

Use with twig syntax

{{ micon('fa-user') }}

Use within render array

// Icon only.
$output['icon'] = [
  '#theme' => 'micon_icon',
  '#icon' => 'fa-user',
];

// Icon with text.
$output['icon_with_text'] = [
  '#theme' => 'micon',
  '#title' => t('Hello World'),
  '#icon' => 'fa-user',
  '#position' => 'after',
  '#icon_only' => FALSE,
];

Use to attach icon to translatable text

// Typical translatable text
t('Hello World');

// Translatable text with icon
micon('Hello World')->setIcon('fa-user');

Use translatable icon trait

use Drupal\micon\MiconIconizeTrait;
class myClass {
    use MiconIconizeTrait;

    protected $title = 'Hello World';

    public function getTitleWithIcon() {
        return $this->micon($this->title)->setIcon('fa-user');
    }
}

Automatic icon replacement

Modules and themes can add a `NAME.micon.icons.yml` that can define text that will be matched to icons.

Exact match

user:
  text: hello world
  icon: fa-user

Regular expression match

user_loose:
  regex: ^hello
  icon: fa-user

When icon definitions are defined this way, modules and themes can utilize any of the above methods of icon placement without having to specify an icon in code.

Alternatives

Versions / Series

2.1.x
Under active development, Drupal ^9 || ^10 compatibility

2.0.x
Drupal 8 compatible, legacy. No more development. Will be unsupported sooner or later.
Upgrade path to 2.1.x (without fear).

8.x-1.x
No more development.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

1 tracked project depends on this one

Activity

Tracked releases
6
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 6
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.1.8 Stable 10–11 Jul 24, 2025
2.1.7 Stable 10–11 Jun 17, 2025
2.1.6 Stable 10–11 Apr 29, 2025
2.1.5 Stable 10–11 Apr 11, 2025
2.1.4 Stable 10–11 Jan 10, 2025
2.1.3 Stable 10–11 Dec 18, 2024