React Icons - 1500+ free icons for your React.js project
React icons library is a great resource for React developers, who can use its customizable SVG icons in their applications. It offers an extensive library of icons to choose from, which can be easily inserted into projects with just a few lines of code. Not only that, but users are also able to customize the appearance of these icons by setting various props on them. This provides developers with an efficient and flexible way to integrate useful graphical elements into their web pages without doing any extra work.
Installation#
To start using CoreUI React Icons in your project, you need to install it as a dependency. Follow the instructions below based on your package manager of choice:
Npm#
npm install @coreui/icons @coreui/icons-react
Yarn#
yarn add @coreui/icons @coreui/icons-react
Usage#
Import react icons using one of these two options:
Single react icon#
To use a single react icon, import the <CIcon>
component and the desired icon(s) from the @coreui/icons
library. Then, include the <CIcon>
component in your code and specify the icon prop with the imported icon variable. Additionally, you can set the desired size for the icon using the size
prop.
import { CIcon } from '@coreui/icons-react';import { cilList, cilShieldAlt } from '@coreui/icons';
...<CIcon icon={cilList} size="xl"/><CIcon icon={cilShieldAlt} size="xl"/>...
All react icons#
To use all icons available in the CoreUI React Icons package, import the CIcon component and the entire @coreui/icons
library using the * as
syntax. Then, reference the desired icon within the icon
prop.
import CIcon from '@coreui/icons-react';import * as icon from '@coreui/icons';
...render() { return ( <CIcon icon={icon.cilList} size="xxl"/> )}...
Color#
The CoreUI React Icon component offers versatile color customization options, empowering you to personalize the icons in multiple ways. You can effortlessly modify the colors by utilizing either class names or CSS variables, providing flexibility and ease in creating visually stunning and cohesive icon designs.
Utility classes#
With some color utility classes, you may use color to convey message.
<CIcon icon={cilList} size="xl" /><CIcon icon={cilList} className="text-primary" size="xl" /><CIcon icon={cilList} className="text-secondary" size="xl" /><CIcon icon={cilList} className="text-success" size="xl" /><CIcon icon={cilList} className="text-danger" size="xl" /><CIcon icon={cilList} className="text-warning" size="xl" /><CIcon icon={cilList} className="text-info" size="xl" />
CSS Variables#
CoreUI React Icons leverage local CSS variables, such as --ci-primary-color
and --ci-secondary-color
(for Duotone icons), to facilitate real-time customization. This allows developers to easily customize the icons by providing their own custom CSS variables.
<CIcon icon={cilList} size="xl" style={{'--ci-primary-color': 'red'}} /><CIcon icon={cilList} size="xl" style={{'--ci-primary-color': 'green'}} />
Sizing#
Set heights of react icons using size property like size="lg" and size="sm".
<CIcon icon={cilList} size="sm" /><CIcon icon={cilList} size="md" /><CIcon icon={cilList} size="lg" /><CIcon icon={cilList} size="xl" /><CIcon icon={cilList} size="xxl" /><CIcon icon={cilList} size="3xl" />
Accessibility#
It's crucial for react icons to be seen by as many people as possible because they have the power to communicate a variety of meaningful information.
People who are blind, have low vision, or have other visual impairments make up approximately 10% of the world's population, and more than 5% of people worldwide have hearing loss that makes them unable to function normally.
Therefore, it's crucial to make sure that the assistive equipment for people with disabilities, such as screen readers, either ignores or better understands the react icons you use online.
Icons are used in one of two ways on websites, apps, and other digital spaces.
Decorative Icons#
It is not necessary to declare an icon to visitors when they are using your website or app if you are utilizing it to offer extra decoration or branding.
Additionally, if you use an icon to visually emphasize or add flair to content that is already present in your HTML, an assistive technology user does not need to see it again.
In certain circumstances, the details of the icon ought to be concealed from the screenreader so as not to obstruct the intended message.
Semantic Icons#
You need to make sure that consumers understand the meaning an icon is intended to represent by giving them text-based alternatives.
This applies to both the content you're using icons to represent (such as the status of your shopping cart or the number of unread messages), as well react icons as interactive controls (such as buttons, form elements, toggles, etc.).
CoreUI React Icons and Accessibility#
Our React Icon component automatically takes care of accessibility concerns by adding appropriate elements.
Decorative icons#
If your icons are only for decorative purposes, the CoreUI React Icon Component will ensure that assistive technology ignores the icon. In addition to referencing an icon as normal, the aria-hidden=true
attribute has been introduced, so there is nothing else you need to do.
If your markup looks like this:
<CButton> <CIcon icon={cilCloudDownload} /></CButton>
By including the aria-hidden
attribute, CoreUI React Icon Component will afterwards automatically hide it from screenreaders.
<button class="btn btn-primary" type="button"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="icon" role="img" aria-hidden="true"> <polygon fill="var(--ci-primary-color, currentColor)" points="272 434.744 272 209.176 240 209.176 240 434.744 188.118 382.862 165.49 405.489 256 496 346.51 405.489 323.882 382.862 272 434.744" class="ci-primary"></polygon><path fill="var(--ci-primary-color, currentColor)" d="M400,161.176c0-79.4-64.6-144-144-144s-144,64.6-144,144a96,96,0,0,0,0,192h80v-32H112a64,64,0,0,1,0-128h32v-32a112,112,0,0,1,224,0v32h32a64,64,0,0,1,0,128H320v32h80a96,96,0,0,0,0-192Z" class="ci-primary"></path> </svg></button>
Semantic icons#
The description that you must set using the title property will be used by CoreUI React Icon Component to generate alternative text for the semantic icon.
Thus, if your markup appears as follows:
<CButton> <CIcon icon={cilCloudDownload} title="Download file" /></CButton>
CoreUI React Icon Component will make the necessary adjustments so that only screenreaders can "see" the supporting elements that convey the message.
<button class="btn btn-primary" type="button"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="icon" role="img" aria-hidden="true"> <polygon fill="var(--ci-primary-color, currentColor)" points="272 434.744 272 209.176 240 209.176 240 434.744 188.118 382.862 165.49 405.489 256 496 346.51 405.489 323.882 382.862 272 434.744" class="ci-primary"></polygon><path fill="var(--ci-primary-color, currentColor)" d="M400,161.176c0-79.4-64.6-144-144-144s-144,64.6-144,144a96,96,0,0,0,0,192h80v-32H112a64,64,0,0,1,0-128h32v-32a112,112,0,0,1,224,0v32h32a64,64,0,0,1,0,128H320v32h80a96,96,0,0,0,0-192Z" class="ci-primary"></path> </svg> <span class="visually-hidden">Download file</span></button>
Available react icons#
The CoreUI React Icons package includes a comprehensive library of more than 1500 icons, available in various formats such as SVG, PNG, and Webfonts. These popular icons are meticulously crafted symbols representing common actions and items. You can utilize them in your digital products, whether they are web or mobile applications, to enhance their visual appeal and user experience.
By leveraging the capabilities of the React Icons component from CoreUI, you can easily incorporate visually appealing icons into their React applications, allowing for more engaging and intuitive user interfaces.
React Icons also provides a variety of customization options, such as the ability to change the size, color, and style of the icons, as well as the ability to add additional CSS classes to the icons. You can find more information on these customization options in the documentation.
Premium icons#
If you find yourself in need of a greater selection of icons, we've got you covered with our premium icon pack. This incredible package boasts an extensive collection of over 4,000 meticulously crafted icons, ensuring that you'll find the perfect representation for any concept or idea. Explore the vast range of options and unlock a world of visual possibilities.
So if you need more icons our PRO package will be a great choice for you.
API#
CIcon#
import { CIcon } from '@coreui/icons-react'// orimport CIcon from '@coreui/icons-react/src/CIcon'
Property | Description | Type | Default |
---|---|---|---|
className | A string of all className you want applied to the component. | string | - |
content Deprecated 3.0+ | Use icon={...} instead of | string | string[] | - |
customClassName | Use for replacing default CIcon component classes. Prop is overriding the 'size' prop. | string | string[] | - |
height | The height attribute defines the vertical length of an icon. | number | - |
icon | Name of the icon placed in React object or SVG content. | string | string[] | - |
name Deprecated 3.0+ | Use icon="..." instead of | string | - |
size | Size of the icon. Available sizes: 'sm', 'lg', 'xl', 'xxl', '3xl...9xl', 'custom', 'custom-size'. | 'custom' | 'custom-size' | 'sm' | 'lg' | 'xl' | 'xxl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | - |
title | Title tag content. | string | - |
use | If defined component will be rendered using 'use' tag. | string | - |
width | The width attribute defines the horizontal length of an icon. | number | - |