bimthebam / silverstripe-lucide-icons
Provides Lucide icons as an inline SVG template helper for Silverstripe CMS
Package info
github.com/bimthebam/silverstripe-lucide-icons
Type:silverstripe-vendormodule
pkg:composer/bimthebam/silverstripe-lucide-icons
Requires
- php: ^8.1
- ext-dom: *
- composer/installers: *
- silverstripe/framework: ^5 || ^6
README
Provides Lucide icons as a template helper for Silverstripe CMS. Icons are rendered inline as SVG, with optional attribute customization.
Requirements
- PHP ^8.1
- Silverstripe Framework ^5 || ^6
Installation
composer require bimthebam/silverstripe-lucide-icons
Usage
Use the $LucideIcon template helper to render an icon by name:
$LucideIcon('arrow-right')
Custom SVG attributes
You can pass additional SVG attributes as extra arguments in key="value" format:
$LucideIcon('arrow-right', 'width="32"', 'height="32"', 'stroke="red"')
Appending to existing attributes
Prefix the value with ... to append to an existing attribute instead of replacing it:
$LucideIcon('arrow-right', 'class="...my-icon"')
This will append my-icon to the existing class attribute of the SVG element.
Icon overriding
Icons can be overridden via Silverstripe's theme system. Place a custom SVG file at the following path within your theme:
themes/<your-theme>/bimthebam/silverstripe-lucide-icons/icons/<icon-name>.svg
The themed version will take priority over the bundled icon.
Caching
Rendered icons are cached automatically. To clear the cache, append ?flush=1 to any URL
or use the CLI:
- Silverstripe 5:
sake dev/build?flush=1 - Silverstripe 6:
sake flush
Bundled icon version
This module includes icons from Lucide v1.7.0.
License
This module is licensed under the BSD-3-Clause license.
The bundled Lucide icons are licensed under the ISC License. Some icons derived from the Feather project are licensed under the MIT License. See LICENSE_LUCIDE.md for details.