whatwedo/twig-bootstrap-icons

v1.1.2 2024-03-25 16:15 UTC

This package is auto-updated.

Last update: 2024-09-25 17:31:34 UTC


README

Bootstrap Icons提供Twig集成。此包受marcw/twig-heroicons的启发。

安装

composer require whatwedo/twig-bootstrap-icons

Twig集成

只需注册扩展

$twig->addExtension(new BootstrapIconsExtensions());

Symfony集成

// bundles.php
return [
    whatwedo\TwigBootstrapIcons\whatwedoTwigBootstrapIconsBundle::class => ['all' => true],
];

用法

输出SVG

{{ bootstrap_icon('alarm') }}

你可以将一个数组作为第二个参数传递,以向<svg>标签添加属性

{{ bootstrap_icon('alarm', {
    class: 'text-gray-500 mr-3 h-6 w-6'
    alt: 'alarm clock'
}) }}