kravcik/latte-font-awesome-icon

Simple {icon} macro for Latte, which allow short entry of font-awesome icons.

v1.0.1 2023-09-18 08:57 UTC

This package is auto-updated.

Last update: 2024-11-18 11:29:16 UTC


README

New font awesome icons - latte generator. Replace older https://github.com/kravcik/nette-macro-fontawesome.

Register Extension

latte:
	extensions: 
		- Kravcik\LatteFontAwesomeIcon\Extension

You can also set default values, it is quite simple:

latte:
	extensions: 
		- Kravcik\LatteFontAwesomeIcon\Extension(defaultStyle: far, defaultFixedWidth: false, defaultElement: i)

Extension parameters

  1. defaultStyle - choose FA style (fas|far|fal|fab etc.), default is fal
  2. defaultFixedWidth - auto adding fa-fw to icons, defaults is true
  3. defaultElement - HTML element to generate icon, default is span

Macro parameters

Parameters can be named or ordered by numeral indexes (see examples)

  1. color - color for current icon, generate text-primary for bootstrap colors, for others go color-xxx
  2. size - size for current icon, for numeric generate fa-2x, for strings fa-lg
  3. fw - fixed width fa-fw for current icon
  4. element - custom HTML element for current icon
  5. style - style for current icon (fas|far|fal|fab etc.)
  6. class - custom class add for current HTML element

Examples

Examples depends on default values, so we using default setting (fal, fw, span).

{icon star} -> <span class="fal fa-star fa-fw"></i>

{icon star, primary} -> <span class="fal fa-star text-primary fa-fw"></span>

{icon star, red} -> <span class="fal fa-star color-red fa-fw"></span>

{icon star, null, lg} -> <span class="fal fa-star fa-lg fa-fw"></span>

{icon star, yellow, 2} -> <span class="fal fa-star color-yellow fa-2x fa-fw"></span>

{icon star, blue, size: 2, style: far} -> <span class="fal fa-star color-blue fa-2x"></span>

{icon star, class: foo, color: green} -> <span class="fal fa-star color-green foo"></span>