Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@shopify/polaris-icons
Advanced tools
[![npm version](https://img.shields.io/npm/v/@shopify/polaris-icons.svg?style=flat)](https://www.npmjs.com/package/@shopify/polaris-icons)
@shopify/polaris-icons is a package that provides a collection of icons used in Shopify's Polaris design system. These icons are designed to be used in Shopify applications to maintain a consistent look and feel.
Importing Icons
You can import individual icons from the @shopify/polaris-icons package. This allows you to use specific icons in your application without importing the entire icon set.
import { CirclePlusMajor } from '@shopify/polaris-icons';
Using Icons in Components
You can use the imported icons in your components by passing them as a source to the Icon component from the Polaris library.
import { Icon } from '@shopify/polaris';
import { CirclePlusMajor } from '@shopify/polaris-icons';
function MyComponent() {
return (
<Icon source={CirclePlusMajor} />
);
}
Customizing Icon Size and Color
You can customize the size and color of the icons by passing additional props to the Icon component.
import { Icon } from '@shopify/polaris';
import { CirclePlusMajor } from '@shopify/polaris-icons';
function MyComponent() {
return (
<Icon source={CirclePlusMajor} color="red" backdrop />
);
}
react-icons is a popular library that provides a wide range of icons from various icon libraries such as Font Awesome, Material Design, and more. It offers a more extensive collection of icons compared to @shopify/polaris-icons and is highly customizable.
fontawesome is a widely-used icon library that offers a vast collection of icons. It provides both free and premium icons and is highly customizable. Font Awesome icons can be used in various frameworks and libraries, making it a versatile choice.
This package exports a JavaScript file containing the Polaris icons partners can use to build on the Shopify platform, and contains SVG files in the
/images/
directory (SVG usage instructions).
Browse and search Polaris icons: https://polaris-icons.shopify.com.
Although it’s possible to use this package directly, we recommend using the icons in this package through Polaris React in combination with the Icon
component. Make sure that your app is using Polaris React version 3.10.0 or higher.
Install Polaris React (instructions) if you haven’t already
Polaris icons as a dependency:
Using npm:
npm install @shopify/polaris-icons --save
Or, using Yarn:
yarn add @shopify/polaris-icons
Import the Icon
component from Polaris React and any icon from Polaris icons into your project.
Import the icon component from Polaris React:
import {Icon} from '@shopify/polaris';
Import an icon from Polaris icons:
import {AddMajorMonotone} from '@shopify/polaris-icons';
Pass the imported Polaris icon to the source
prop of the Icon
component:
<Icon source={AddMajorMonotone} />
For projects that don’t use React, icons are also available as *.svg
files in the images
folder.
Browse the list of SVG files, hosted on the unpkg CDN (Content Delivery Network).
Suggested CSS and markup for projects that aren’t using the Polaris HTML and CSS components:
.Custom-Polaris-Icon {
display: block;
height: 2rem; /* or value equivalent to 20px */
width: 2rem; /* or value equivalent to 20px */
max-height: 100%;
max-width: 100%;
margin: auto;
}
.Custom-Polaris-Icon__Svg {
position: relative;
display: block;
width: 100%;
max-width: 100%;
max-height: 100%;
/* Icon color */
fill: #000;
/* White fill in twotone icons */
color: #fff;
}
<span class="Custom-Polaris-Icon">
<svg
viewBox="0 0 20 20"
class="Custom-Polaris-Icon__Svg"
focusable="false"
aria-hidden="true"
>
<path fill="currentColor" d="M7 13h6v6H7z" />
<path
d="M19.664 8.252l-9-8a1 1 0 0 0-1.328 0L8 1.44V1a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v5.773L.336 8.252a1.001 1.001 0 0 0 1.328 1.496L2 9.449V19a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9.449l.336.299a.997.997 0 0 0 1.411-.083 1.001 1.001 0 0 0-.083-1.413zM16 18h-2v-5a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1v5H4V7.671l6-5.333 6 5.333V18zm-8 0v-4h4v4H8zM4 2h2v1.218L4 4.996V2z"
fill-rule="evenodd"
/>
</svg>
</span>
To add, remove, or rename icons, follow the contributing guide (restricted to Shopify employees). 👀
FAQs
[![npm version](https://img.shields.io/npm/v/@shopify/polaris-icons.svg?style=flat)](https://www.npmjs.com/package/@shopify/polaris-icons)
The npm package @shopify/polaris-icons receives a total of 111,639 weekly downloads. As such, @shopify/polaris-icons popularity was classified as popular.
We found that @shopify/polaris-icons demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 24 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.