aimanecouissi / module-hyva-boxicons
Add the Boxicons SVG icon set to Hyvä Themes
Package info
github.com/aimanecouissi/magento2-module-hyva-boxicons
Type:magento2-module
pkg:composer/aimanecouissi/module-hyva-boxicons
Requires
- php: ^8.3
- aimanecouissi/module-hyva-svg-icons: ^1.0
- hyva-themes/magento2-theme-module: >=1.1.12
- magento/framework: 103.0.*
README
Integrates the Boxicons free SVG icon set into Hyvä Themes, exposing basic, filled, and brands styles as dedicated SvgIcons view models. Browse the included icons in the SVG directory or preview them at boxicons.com.
Note
This module only includes the free Boxicons set.
Installation
composer require aimanecouissi/module-hyva-boxicons bin/magento module:enable AimaneCouissi_HyvaSvgIcons AimaneCouissi_HyvaBoxicons bin/magento setup:upgrade bin/magento cache:flush
Usage
In Hyvä PHTML templates
Require the view models for the styles you need and call their helper methods to render icons:
<?php use AimaneCouissi\HyvaBoxicons\ViewModel\BoxiconsBasic; use AimaneCouissi\HyvaBoxicons\ViewModel\BoxiconsBrands; use AimaneCouissi\HyvaBoxicons\ViewModel\BoxiconsFilled; use Hyva\Theme\Model\ViewModelRegistry; /** @var ViewModelRegistry $viewModels */ $boxiconsBasic = $viewModels->require(BoxiconsBasic::class); $boxiconsFilled = $viewModels->require(BoxiconsFilled::class); $boxiconsBrands = $viewModels->require(BoxiconsBrands::class); ?>
<?= $boxiconsBasic->cartHtml('w-6 h-6', 24, 24, ['aria-label' => 'Cart']) ?> <?= $boxiconsFilled->starHtml('w-5 h-5 text-yellow-400', 20, 20, ['aria-hidden' => 'true']) ?> <?= $boxiconsBrands->instagramHtml('w-6 h-6', 24, 24, ['aria-label' => 'Instagram']) ?>
Methods are generated from SVG filenames and fully documented via PHPDoc on each view model, so your IDE can autocomplete them.
In CMS content
The module registers three icon prefixes for Hyvä SvgIcons: boxicons-basic, boxicons-filled, and boxicons-brands. Icons can be used directly in CMS pages, blocks, and widgets:
{{icon "boxicons-basic/cart" classes="inline-block w-6 h-6" width=24 height=24}}
{{icon "boxicons-filled/star" classes="inline-block w-5 h-5 text-yellow-400" width=20 height=20}}
{{icon "boxicons-brands/instagram" classes="inline-block w-6 h-6" width=24 height=24}}
Uninstall
bin/magento module:disable AimaneCouissi_HyvaBoxicons composer remove aimanecouissi/module-hyva-boxicons bin/magento setup:upgrade bin/magento cache:flush
Changelog
See CHANGELOG for all recent changes, including icon set version updates.
License
The Boxicons SVG icons are created by Boxicons and licensed under CC BY 4.0.
Warning
Individual brand icons may be subject to their own trademark and usage guidelines. Trademark usage is the responsibility of the end user. Please consult individual brand guidelines before displaying logos in commercial contexts.
This module's source code is separately licensed under MIT.