aimanecouissi / module-hyva-boxicons
Add the Boxicons SVG icon pack to Hyvä Themes
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:magento2-module
pkg:composer/aimanecouissi/module-hyva-boxicons
Requires
- php: ~8.3.0||~8.4.0
- hyva-themes/magento2-theme-module: >=1.1.12
- magento/framework: 103.0.*
README
Integrates the Boxicons 3.0.7 SVG icon pack into Hyvä Themes, exposing solid, outline, and brands styles as dedicated SvgIcons view models.
This module is built specifically for Hyvä frontends and assumes you already have a working Hyvä theme.
Installation
composer require aimanecouissi/module-hyva-boxicons bin/magento module:enable 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\BoxiconsBrands; use AimaneCouissi\HyvaBoxicons\ViewModel\BoxiconsOutline; use AimaneCouissi\HyvaBoxicons\ViewModel\BoxiconsSolid; use Hyva\Theme\Model\ViewModelRegistry; /** @var ViewModelRegistry $viewModels */ $boxiconsSolid = $viewModels->require(BoxiconsSolid::class); $boxiconsOutline = $viewModels->require(BoxiconsOutline::class); $boxiconsBrands = $viewModels->require(BoxiconsBrands::class); ?>
<?= $boxiconsSolid->homeHtml('w-6 h-6', 24, 24, ['aria-label' => 'Home (solid)']) ?> <?= $boxiconsOutline->searchHtml('w-5 h-5', 20, 20, ['aria-label' => 'Search (outline)']) ?> <?= $boxiconsBrands->githubHtml('w-4 h-4', 16, 16, ['aria-label' => 'GitHub']) ?>
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-solid, boxicons-outline, and boxicons-brands. Icons can be used directly in CMS pages, blocks, and widgets:
{{icon "boxicons-solid/home" classes="inline-block w-6 h-6" width=24 height=24}}
{{icon "boxicons-outline/search" classes="inline-block w-5 h-5" width=20 height=20}}
{{icon "boxicons-brands/github" classes="inline-block w-4 h-4" width=16 height=16}}
Uninstall
bin/magento module:disable AimaneCouissi_HyvaBoxicons composer remove aimanecouissi/module-hyva-boxicons bin/magento setup:upgrade bin/magento cache:flush
License
The Boxicons SVG icons bundled in this module are created by Atisa and licensed under CC BY 4.0. Brand icons are trademarks of their respective owners.
This module's source code is separately licensed under MIT.