@wordpress/icons package is the official WordPress icon library, providing a comprehensive collection of SVG icons for use in your WordPress projects.
Installation
Install the package using npm:This package assumes that your code will run in an ES2015+ environment. If you’re using an environment with limited support for such language features, include the polyfill shipped in
@wordpress/babel-preset-default.Basic Usage
Import theIcon component along with the specific icon you want to use:
Icon Component Props
TheIcon component accepts the following props:
| Prop | Type | Default | Description |
|---|---|---|---|
icon | Component | required | The icon component to render |
size | number | 24 | Size of the icon in pixels |
Examples
Popular Icons
Here are some commonly used icons from the library:check
Checkmark for confirmations
close
Close or dismiss actions
arrowLeft
Back or previous navigation
arrowRight
Forward or next navigation
plus
Add or create new items
trash
Delete or remove items
cog
Settings and configuration
search
Search functionality
star
Favorites or ratings
Using Icons as Components
You can also use icons directly as components without theIcon wrapper:
Icon Categories
The icon library includes icons across various categories:Action Icons
Icons for common actions:Navigation Icons
Icons for navigation:Block Editor Icons
Icons specific to block editing:Social Icons
Social media platform icons:Styling Icons
Icons inherit the current text color by default. You can style them using CSS:Browse All Icons
Explore the complete icon library with interactive examples: View Icons in Storybook →Contributing New Icons
To add a new icon to the library:Add the SVG file
Place your SVG file in the
src/library/ directory using kebab-case naming (e.g., my-new-icon.svg).Update manifest.json
Add an entry to
src/manifest.json:Set
public: true only if you want to expose this icon through the SVG Icons API. Once public, removing icons becomes difficult, so consider carefully.TypeScript Support
This package includes full TypeScript definitions:Peer Dependencies
This package requires React as a peer dependency:Package Details
Related Packages
@wordpress/components- UI components that use these icons@wordpress/element- React abstraction layer@wordpress/primitives- SVG primitives for icons
Icon Design Guidelines
When creating custom icons for the WordPress ecosystem:- Use a 24×24px viewBox
- Keep designs simple and recognizable
- Use a 2px stroke width for consistency
- Maintain visual balance and optical alignment
- Follow the existing icon style
- Test icons at different sizes
- Ensure accessibility with proper labels