Quick Start
Looking to quickly add Boxicons to your project? Use the paths to CDN or Download the files here.
Install via NPM
Install the boxicons package by copy pasting the following in your terminal:
$ npm install boxicons --save
Import the npm module in your javascript
import 'boxicons'
Using the Web Component
Boxicons includes a Custom Element that makes using icons easy and efficient. To use it, add the boxicons.js
file to the page:
<script src="https://unpkg.com/boxicons@2.1.4/dist/boxicons.js"></script>
To use an icon, add the box-icon
element to the location where the icon should be displayed:
<box-icon name="rocket"></box-icon>
To use solid icons or logos add attribute type
as solid or logo
<box-icon type="solid" name="rocket"></box-icon>
<box-icon type="logo" name="facebook-square"></box-icon>
The box-icon
custom element supports the following attributes:
<box-icon
type = "regular|solid|logo"
name="adjust|alarms|etc...."
color="blue|red|etc..."
size="xs|sm|md|lg|cssSize"
rotate="90|180|270"
flip="horizontal|vertical"
border="square|circle"
animation="spin|tada|etc..."
animation="spin|tada|etc..."
pull = "left|right"
></box-icon>
Usage as a Font
Import the CSS
Copy-paste the stylesheet link
into your head
to load our CSS
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
This will load boxicons font into your webpage
HTML
To use an icon on your page, add a prefixbx-
for regular icons, bxs-
for solid icons & bxl-
for logos followed by the icon name and seperate class with thebx
:
<i class='bx bx-user'></i>
<i class='bx bxs-user'></i>
<i class='bx bxl-facebook-square'></i>
Starter Templates
Create an HTML document and copy-paste the starter template
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>
<!-- Boxicons CSS -->
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
<title>Hello, Boxicons!</title>
</head>
<body>
<h1>Hello, Boxicons!</h1>
<i class='bx bx-hot'></i>
<i class='bx bxs-hot'></i>
<i class='bx bxl-facebook-square'></i>
</body>
</html>
A template for usage with the web component instead of icon font
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>
<!-- Boxicons JS -->
<link href='https://unpkg.com/boxicons@2.1.4/dist/boxicons.js' rel='stylesheet'>
<title>Hello, Boxicons!</title>
</head>
<body>
<h1>Hello, Boxicons!</h1>
<box-icon name='hot'></box-icon>
<box-icon type='solid' name='hot'></box-icon>
<box-icon type='logo' name='facebook-square'></box-icon>
</body>
</html>
Styling
Sizing
You can change size of the icon withfont-size
CSS. It will inherit the font-size
from the parent by default. There are fixed sizes you can add to the icon by adding classesbx-xs
, bx-sm
, bx-md
and bx-lg
<i class='bx bxs-like bx-xs'></i>
<i class='bx bxs-like bx-sm'></i>
<i class='bx bxs-like bx-md'></i>
<i class='bx bxs-like bx-lg'></i>
<!-- Boxicons web component -->
<box-icon name='like' size='lg'></box-icon>
Rotation & Flipping
Rotate the icons using classes bx-rotate-90
, bx-rotate-180
and bx-rotate-270
or Flip the icons using bx-flip-horizontal
and bx-flip-vertical
<i class='bx bxs-like bx-rotate-90'></i>
<i class='bx bxs-like bx-rotate-180'></i>
<i class='bx bxs-like bx-rotate-270'></i>
<i class='bx bxs-like bx-flip-horizontal'></i>
<i class='bx bxs-like bx-flip-vertical '></i>
<!-- Boxicons web component -->
<box-icon name='like' rotate='90'></box-icon>
<box-icon name='like' flip='horizontal'></box-icon>
List Icons
Use icons as bullets for the list by adding class bx-ul
to the unordered list element and include the icons inside theli
- List item 1
- List item 2
- List item 3
<ul class='bx-ul'>
<li><i class='bx bx-right-arrow'></i>List Item 1</li>
<li><i class='bx bx-x'></i>List Item 2</li>
<li><i class='bx bx-plus'></i>List Item 3</li>
</ul>
Fixed Width
You can use fixed width class bx-fw
\to get a fixed width icon next to the textli
<i class='bx-fw bx bxl-facebook-square'></i>Facebook
Pulled Icons
Use class bx-pull-left
or bx-pull-right
on icons for easy pull quotesli
<i className='bx-pull-left bx bxs-quote-alt-left bx-lg'/>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut faucibus erat eu nibh laoreet, sed ullamcorper diam ornare. Quisque viverra ante nec luctus imperdiet. Quisque ut imperdiet nisi. Quisque ultrices laoreet odio, non vestibulum lacus molestie sollicitudin. Phasellus nec dolor eget nunc commodo sodales vel vel eros. <!-- Boxicons web component -->
<box-icon name='like' pull='left' size='lg'></box-icon>
Quisque ultrices laoreet odio, non vestibulum lacus molestie sollicitudin. Phasellus nec dolor eget nunc commodo sodales vel vel eros.
Border
Add border to your icons with classes bx-border
, bx-border-circle
<i class='bx bxs-heart bx-border'></i>
<i class='bx bxs-heart bx-border-circle'></i>
<!-- Boxicons web component -->
<box-icon name='heart' border='circle'></box-icon>
Animation
Animate your icons with pre built CSS animations using classes bx-spin
,bx-tada
,bx-flashing
,bx-burst
,bx-fade-left
and bx-fade-right
You can change the speed of the animation with the animation-duration
property & to change the number of times the animation takes place with the property animation-iteration-count
in CSS
<i class='bx bxs-like bx-spin'></i>
<i class='bx bxs-like bx-tada'></i>
<i class='bx bxs-like bx-flashing'></i>
<i class='bx bxs-like bx-burst'></i>
<i class='bx bxs-like bx-fade-left'></i>
<i class='bx bxs-like bx-fade-right'></i>
<i class='bx bxs-like bx-fade-up'></i>
<i class='bx bxs-like bx-fade-down'></i>
<!-- Boxicons web component -->
<box-icon name='bell' animation='tada'></box-icon>
Animation on Hover
Animate your icons on hover with pre built CSS animations using classes bx-spin-hover
,bx-tada-hover
,bx-flashing-hover
,bx-burst-hover
,bx-fade-left-hover
and bx-fade-right-hover
You can change the speed of the animation with the animation-duration
property & to change the number of times the animation takes place with the property animation-iteration-count
in CSS
<i class='bx bxs-like bx-spin-hover'></i>
<i class='bx bxs-like bx-tada-hover'></i>
<i class='bx bxs-like bx-flashing-hover'></i>
<i class='bx bxs-like bx-burst-hover'></i>
<i class='bx bxs-like bx-fade-left-hover'></i>
<i class='bx bxs-like bx-fade-right-hover'></i>
<i class='bx bxs-like bx-fade-up-hover'></i>
<i class='bx bxs-like bx-fade-down-hover'></i>
<!-- Boxicons web component -->
<box-icon name='bell' animation='tada-hover'></box-icon>
Contribution
Want to report a bug ? Have some suggestions or ideas ? Have an icon or a feature request? Create a new issue on Github with the appropriate label here
License
The MIT License (MIT)
Copyright (c) 2015-2021 Aniket Suvarna
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.