whatwedo/twig-bootstrap-icons

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

This package is auto-updated.

Last update: 2024-04-25 16:30:36 UTC


README

Twig Integration for Bootstrap Icons. This bundle is inspred by marcw/twig-heroicons.

Installation

composer require whatwedo/twig-bootstrap-icons

Twig Integration

Just register the extension

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

Symfony Integration

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

Usage

Outputs the SVG

{{ bootstrap_icon('alarm') }}

you can pass an array as second argument to add attributes to the <svg>-tag:

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