Inline Icon Integration with Twig

Last updated on
3 June 2024

Provides a straightforward method for incorporating icons directly within your Twig templates. This functionality mirrors the format of render elements, allowing for seamless integration and customization of icons in your site.

{{ iconify_icon(icon, parameters) | raw }}

Parameters:

  • icon: The icon ID with the next format, icon_name (icon_collection) (e.g.: car (mdi))
  • parameters: (array, optional) Iconify parameters to apply to the icon.
    • width: Sets the width of the icon (e.g.: 55)
    • height: Sets the height of the icon (e.g.: 55)
    • color: Sets the color of the icon (e.g.: '#c00707')
    • flip: Flips the icon horizontally or vertically (e.g.: 'vertical')
    • rotate: Rotates the icon by a specified degree (e.g.: '90)

Usage example:

{{ iconify_icon('car (mdi)', { width: 55, height: 55, color:'#c00707', flip:'vertical', rotate: '90' }) | raw }}

Help improve this page

Page status: No known problems

You can: