Download the PHP package blade-ui-kit/blade-icons without Composer
On this page you can find all versions of the php package blade-ui-kit/blade-icons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blade-ui-kit/blade-icons
More information about blade-ui-kit/blade-icons
Files in blade-ui-kit/blade-icons
Package blade-icons
Short Description A package to easily make use of icons in your Laravel Blade views.
License MIT
Homepage https://github.com/blade-ui-kit/blade-icons
Informations about the package blade-icons
Blade Icons
A package to easily make use of SVG icons in your Laravel Blade views. Originally "Blade SVG" by Adam Wathan.
Turn...
Into...
Or into...
Looking for a specific icon? Try our icon search: https://blade-ui-kit.com/blade-icons#search
Any sponsorship to help fund development is greatly appreciated ❤️
Icon Packages
Blade Icons is a base package to make it easy for you to use SVG icons in your app. In addition, there's also quite some third party icon set packages. Thanks to the community for contributing these!
We're not accepting requests to build new icon packages ourselves but you can start building your own.
- Blade Academicons by Swapnil Sarwe
- Blade Akar Icons by Swapnil Sarwe
- Blade Ant Design Icons by Swapnil Sarwe
- Blade Bootstrap Icons by David H. Sianturi
- Blade Boxicons by Dan Pock
- Blade Bytesize Icons by Swapnil Sarwe
- Blade Carbon Icons by Swapnil Sarwe
- Blade Circle Flags by Fahri Meral
- Blade Clarity Icons by Swapnil Sarwe
- Blade Coolicons by Swapnil Sarwe
- Blade CoreUI Icons by Adrián UB
- Blade Country Flags by Stijn Vanouplines
- Blade Cryptocurrency Icons by Swapnil Sarwe
- Blade CSS Icons by khatabWedaa
- Blade Dev Icons by Swapnil Sarwe
- Blade Element Plus Icons by Swapnil Sarwe
- Blade Elusive Icons by Swapnil Sarwe
- Blade Emblemicons by Swapnil Sarwe
- Blade Entypo by Owen Voke
- Blade EOS Icons by Swapnil Sarwe
- Blade Eva Icons by Nehal Hasnayeen
- Blade Evil Icons by Swapnil Sarwe
- Blade Feather Icons by Bruno Falcão
- Blade File Icons by Swapnil Sarwe
- Blade File Type Icons by Brandon Nifong
- Blade FluentUi System Icons by Swapnil Sarwe
- Blade Flowbite Icons by Dominique Thomas
- Blade Font Audio by Swapnil Sarwe
- Blade Font Awesome by Owen Voke
- Blade Fontisto Icons by Swapnil Sarwe
- Blade Fork Awesome by Swapnil Sarwe
- Blade Github Octicons by Tim Joosten
- Blade Google Material Design Icons by Swapnil Sarwe
- Blade Gov Icons by Swapnil Sarwe
- Blade Gravity UI Icons by Swapnil Sarwe
- Blade Grommet Icons by Swapnil Sarwe
- Blade Health Icons by Giulio Troccoli-Allard
- Blade Heroicons by Dries Vints
- Blade Hugeicons by Mustafa Afat
- Blade Humbleicons by Swapnil Sarwe
- Blade IcoMoon Icons by Joe Sylnice
- Blade Icon Park Icons by Swapnil Sarwe
- Blade Iconic Icons by Malik Alleyne-Jones
- Blade Iconoir by Andrei Ioniță
- Blade Iconsax by Saade
- Blade Ikonate Icons by Swapnil Sarwe
- Blade Ionicons by Faisal Ahmed
- Blade Jam Icons by Swapnil Sarwe
- Blade Lets Icons by Mansoor Ahmed
- Blade Line Awesome Icons by Swapnil Sarwe
- Blade Lineicons by Ngô Quốc Đạt
- Blade Lucide Icons by Dan Pock
- Blade Majestic Icons by Swapnil Sarwe
- Blade Maki Icons by Swapnil Sarwe
- Blade Material Design Icons by Postare
- Blade Memory Icons by Swapnil Sarwe
- Blade Microns by Swapnil Sarwe
- Blade Mono Icons by Swapnil Sarwe
- Blade Pepicons by Swapnil Sarwe
- Blade Phosphor icons by Swapnil Sarwe
- Blade Pixelarticons by Swapnil Sarwe
- Blade Polaris Icons by Samoilenko Eduard
- Blade Prime Icons by Swapnil Sarwe
- Blade Radix Icons by Swapnil Sarwe
- Blade Remix Icon by Andrei Ioniță
- Blade RPG Awesome Icons by Swapnil Sarwe
- Blade Simple Icons by Adrián UB
- Blade Simple Line Icons by Swapnil Sarwe
- Blade Solar Icons by Swapnil Sarwe
- Blade System UIcons by Swapnil Sarwe
- Blade Tabler Icons by Ryan Chandler
- Blade Teeny Icons by Swapnil Sarwe
- Blade Typicons by Swapnil Sarwe
- Blade Uiw Icons by Swapnil Sarwe
- Blade Unicons by Swapnil Sarwe
- Blade UntitledUI Icons by Arthur Monney
- Blade Vaadin Icons by Swapnil Sarwe
- Blade VSCode Codicons by Swapnil Sarwe
- Blade Weather Icons by Swapnil Sarwe
- Blade Zondicons by Swapnil Sarwe
Requirements
- PHP 7.4 or higher
- Laravel 8.0 or higher
Installation
Install the package with composer:
Then, publish the configuration and uncomment the default
icon set:
Make sure that the path defined for this icon set exists. By default it's resources/svg
. Your SVG icons will need to be placed in this directory.
Upgrading
Please refer to the upgrade guide
when upgrading the library.
Caching
When working with Blade Icons, and third party icon sets in particular, you'll often be working with large icon sets. This can slow down your app tremendously, especially when making use of Blade components. To solve this issue, Blade Icons ships with caching support. To enable icon caching you can run the following command:
This will create a blade-icons.php
file in bootstrap/cache
similar to the packages.php
cached file. It'll contain a manifest of all known sets and icons with their path locations.
Caching icons means you won't be able to add extra icons, change paths for icon sets or install/remove icon packages. To do so make sure you first clear the icons cache and cache after you've made these changes:
It's a good idea to add the icons:cache
command as part of your deployment pipeline and always cache icons in production.
Alternatively, you may choose to disable Blade components entirely.
Also, when adding new icons, renaming directories in your icon paths, it's always a good idea to clear your views before refreshing the page:
Configuration
Defining Sets
Blade Icons support multiple sets. You can define these by passing a key/value combination in the blade-icons.php
config file's sets
setting:
Feel free to add as many sets as you wish. Blade Icons ships with a default
set for your app which you may adjust to your liking.
Icon Paths
If you wanted to add icons from a different directory in your app, say resources/images/svg
, you can set it like this:
[!WARNING]
Always make sure you're pointing to existing directories.
Multiple Paths
In addition to a single path, you may define multiple paths for a single set with the paths
option instead:
This gives you the benefit from grouping icons from different paths under a single set where you can define the same prefix and default classes.
[!WARNING] When using multiple paths instead of one, Blade Icons will return the first icon it finds when an icon name is present in more than one path. Please ensure you use unique icon names when registering multiple paths if you want to retrieve the correct icon.
Filesystem Disk
If you host your icons on an external filesystem storage you can set the disk
option for an icon set to a disk defined in your filesystems.php
config file. For example, you might store your icons on an AWS S3 bucket which is set in your filesystems.php
config file with a disk key of s3-icons
:
And from now on our default set will pull the icons from the S3 bucket. Also notice we've adjusted the path to /
because we store our icons in the root directory of this S3 bucket. If you have several icon sets uploaded to the same disk you can set your paths accordingly:
Fallback Icons
If you want to provide a fallback icon when an icon cannot be found, you may define the fallback
option on a specific set:
Now when you try to resolve a non-existing icon for the default icon set, it'll return the rendered "cake" icon instead.
You can also provide a global fallback icon instead. This icon will be used when an icon cannot be found and the set doesn't have its own fallback icon defined. It can reference any icon from any registered icon set.
[!NOTE] There's one caveat when using fallback icons and that is that they don't work when using Blade Components. In this case, Laravel will throw an exception that the component cannot be found. If you want to make use of fallback icons please consider one of the other usages.
Prefixing Icons
In the default icon set the icon
prefix will be applied to every icon, but you're free to adjust this in the blade-icons.php
config file:
Defining a prefix for every set is required and every prefix should be unique.
When referencing icons with the helper you can omit the prefix to reference icons from the default
set. When referencing icons from other sets, using the prefix is required.
When an icon in the default set has a name which collides with a prefix from a set then the icon from the default set is retrieved first.
Please note that it's best practice that your icons themselves do not have the prefix in their name. So if you have a prefix in your set called icon
and your icons are named icon-example.svg
you should rename them to example.svg
. Otherwise you can run into unexpected name resolving issues.
It's also important to note that icon prefixes cannot contain dashes (-
) as this is the delimiter which we use to split it from the rest of the icon name.
Default Classes
You can optionally define classes which will be applied to every icon by filling in the class
setting in your blade-icons.php
config file:
If you don't want any classes to be applied by default then leave this as an empty string. Additionally, the same option is available in sets so you can set default classes on every set.
The sequence in which classes get applied is <global classes> <set classes> <explicit classes>
. You can always override this by passing an explicit class with your attributes. Component classes cannot be overridden.
Default Attributes
You can also optionally define some attributes which will be added to every icon in the attributes
setting of your blade-icons.php
config file:
This always needs to be an associative array. Additionally, the same option is available in sets so you can set default attributes on every set.
The sequence in which classes get applied is default attributes / set attributes / explicit attributes
where the latter overwrites the former. It is not possible to overwrite existing attributes on SVG icons. If you already have attributes defined on icons which you want to override, remove them first.
Usage
There are several ways of inserting icons into your Blade templates. We personally recommend using Blade components, but you can also make use of a Blade directive if you wish.
Components
The easiest way to get started with using icons from sets are Blade components:
Icons in subdirectories can be referenced using dot notation:
You can also pass classes to your icon components (default classes will be applied as well):
Or any other attributes for that matter:
[!NOTE] With Blade components, using a prefix is always required, even when referencing icons from the default set.
Deferring icons
When you're using the same icon in lots of places on the page the DOM element count may explode upwards. To remedy this you can add the defer attribute to the components:
This will push the icons to the stack "bladeicons", you should load this stack at the bottom of your page
[!WARNING] Deferring icons is only possible using the
<x-icon>
component. This feature doesn't work with the@svg
Blade directive or thesvg()
helper function.
Using deferred icons in JavaScript
You can re-use your icons from blade in your JavaScript rendered views by providing a custom defer value that will be used as an identifier:
Then, in your JavaScript, create an svg
element with use
and href="#icon-{your-hash}"
attribute.
Default Component
If you don't want to use the component syntax from above you can also make use of the default Icon
component that ships with Blade Icons. Simply pass the icon name through the $name
attribute:
If you want to use a different name for this component instead you can customize the components.default
option in your blade-icons.php
config file:
Then reference the default icon as follow:
You can also completely disable this default component if you want by setting its name to null
:
Disabling Components
Although they're enabled by default, if you don't wish to use components at all you may choose to disable them completely by setting the components.disabled
setting in your blade-icons.php
config file to true
:
Doing this makes sense when you're only using the helper and can improve overall performance.
Directive
If components aren't really your thing you can make use of the Blade directive instead. If you defined a default icon
class in your config and want to render a camera
icon with an icon-lg
class you can do that like so:
Any additionally attributes can be passed as a third array argument, and they'll be rendered on the svg
element:
If you don't have a class to be defined you can also pass these attributes as the second parameter:
If you want to override the default classes, pass in the class as an attribute:
Attributes without a key, are supported too:
Helper
If you'd like, you can use the svg
helper to expose a fluent syntax for setting SVG attributes:
Accessibility
If the icon should have semantic meaning, a text alternative can be added with the title attribute. Refer to the Usage section of this documentation to learn how to add an attribute.
For almost all use cases, your icon will be assuming the role of an image. This means that deciding on if your icon has any semantic meaning, or what that semantic meaning is, you can use the WCAG alt text decision tree.
If your icon has semantic meaning, using the title attribute will apply the following features to the SVG element:
- Child element of
<title>
with a unique ID containing the value that was passed title
attribute containing the value that was passedrole="img"
aria-labelledby
to refer to the unique ID of the title element
Example usage:
Example result:
If your icon does not have semantic meaning, you may want to hide the icon to reduce overall document clutter. You may do this by adding aria-hidden="true"
to your icon.
Building Packages
If you're interested in building your own third party package to integrate an icon set, it's pretty easy to do so. We've created a template repo for you to get started with. You can find the getting started instructions in its readme.
If you want to learn how to create packages we can recommend these two excellent courses:
Make sure to load your SVGs from the register
method of your package's service provider. Provide the path to your SVGs and provide your own unique set name and component prefix:
Now your icons can be referenced using a component, directive or helper:
Don't forget to make blade-ui-kit/blade-icons
a requirement of your package's composer.json
.
Generating Icons
Blade Icons also offers an easy way to generate icons for your packages. By defining a config file with predefined source and destination paths, you can make updating your icons a breeze.
First, start off by creating a generation.php
config file in the config
directory of your icon package. Next, you can define an array per icon set that you want to generate. Below is a full version of this file with explanation for every option. Only the source
and destination
options are required.
See an example config/generation.php
file for the Heroicons package.
After setting up your config file you can use the icon generation as follow from the root of your icon package directory:
Changelog
Check out the CHANGELOG in this repository for all the recent changes.
Maintainers
Blade Icons is developed and maintained by Dries Vints.
License
Blade Icons is open-sourced software licensed under the MIT license.
All versions of blade-icons with dependencies
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
illuminate/filesystem Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/view Version ^8.0|^9.0|^10.0|^11.0
symfony/console Version ^5.3|^6.0|^7.0
symfony/finder Version ^5.3|^6.0|^7.0