gumbraise/twig-heroicons
最新稳定版本:2.0.18.3
Composer 安装命令:
composer require gumbraise/twig-heroicons
包简介
Unofficial Twig integration for Heroicons
README 文档
README
This package provides a Heroicons integration for Twig.
Install
Use composer:
composer require gumbraise/twig-heroicons
Symfony
You do not need to do anything more to use the extension.
Twig
If you use Twig directly, register the extension before using it:
<?php use MarcW\Heroicons\Twig\HeroiconsExtension; use Twig\Environment; $twig = new Environment(/* ... */); $twig->addExtension(new HeroiconsExtension());
Usage
This extension provides a heroicon function that outputs the icon SVG.
{# function signature #} {{ heroicon(icon, style, options) }} {# the default style is 'solid' #} {{ heroicon('academic-cap') }} {# use the 'outline' style #} {{ heroicon('academic-cap', 'outline') }} {# use the 'mini' style #} {{ heroicon('academic-cap', 'mini') }} {# Add a custom class to the SVG #} {{ heroicon('academic-cap', 'outline', { 'class': "text-green-200", }) }}
Supported Options
You can add several options at the same time.
- Class
{{ heroicon(icon, style, { 'class': '...' }) }} - Stroke
{{ heroicon(icon, style, { 'stroke': '#......' }) }} - Stroke Width
{{ heroicon(icon, style, { 'stroke-width': '...' }) }} - Fill
{{ heroicon(icon, style, { 'fill': '#......' }) }}
License
This library is MIT licensed.
统计信息
- 总下载量: 1.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-02