Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-native-vector-icons

> 前端框架
Open source

Customizable Icons for React Native with support for image source and full styling.

17.9K stars0 likes3 views
WebsiteGitHub

About

Customizable Icons for React Native with support for image source and full styling.

React Native Vector Icons

Elevate your React Native applications with the power of customizable vector icons. Ideal for embellishing buttons, logos, and navigation or tab bars, these icons seamlessly integrate into your projects. Their versatility makes extension and styling effortless.

For the integration of .svg files natively, you can explore react-native-vector-image.

[!TIP] If you are still using the old single package react-native-vector-icons visit https://github.com/oblador/react-native-vector-icons/tree/10.x. To migrate to the package-per-icon-set approach, see MIGRATION.md.

Table of Contents

  • Sponsorship
  • Available Icon Sets
  • Installation
  • Setup
  • Icon Component
  • Usage as PNG Image/Source Object
  • Multi-Style Fonts
  • Custom Fonts
  • Animation
  • Dynamic icon font loading
  • Usage Examples
  • Changelog
  • License

Sponsorship

Should you find this library beneficial, kindly contemplate the option of sponsoring.

Available Icon Sets

Explore all icons.

RNVI comes with the following supported icons. You can search NPM for third party icons.

Actively maintained

  • AntDesign from Ant Group (v4.4.2 with 449 icons)
  • Feather created by Cole Bemis & Contributors (v4.29.2 featuring 287 icons)
  • FontAwesome designed by Fonticons, Inc. (v7.2.0 featuring 2,806 free and 75,767 pro icons)
  • Foundation by ZURB, Inc. (v3.0 with 283 icons)
  • Ionicons crafted by Ionic (v8.0.9 containing 1,357 icons)
  • MaterialDesignIcons from MaterialDesignIcons.com (v7.4.47 including 7448 icons)
  • Octicons designed by GitHub, Inc. (v19.23.1 with 370 icons)
  • Lucide designed by Lucide, (v1.7.0 with 1,941 icons)

No longer maintained upstream

  • Entypo by Daniel Bruce (v1.0.1 with 411 icons)
  • EvilIcons designed by Alexander Madyankin & Roman Shamin (v1.10.1 with 70 icons)
  • FontAwesome 4 by Fonticons, Inc. (v4.7.0 containing 785 icons)
  • FontAwesome 5 from Fonticons, Inc. (v5.15.4 offering 1611 free and 7869 pro icons)
  • FontAwesome 6 designed by Fonticons, Inc. (v6.7.2 featuring 2060 free and 52663 pro icons)
  • Fontisto created by Kenan Gündoğan (v3.0.4 featuring 617 icons)
  • MaterialIcons by Google, Inc. (v4.0.0 featuring 2234 icons)
  • SimpleLineIcons crafted by Sabbir & Contributors (v2.5.5 with 189 icons)
  • Zocial by Sam Collins (v1.1.1 with 100 icons)

Migration

See MIGRATION.md if you are migrating from react-native-vector-icons to the package-per-icon-set approach or between major versions.

Installation

  1. Install the packages for the icons you want to use
bash
npm install @react-native-vector-icons/fontawesome-free-solid @react-native-vector-icons/lucide
  1. Depending on the platform you're targeting (iOS/Android/Windows), follow the appropriate setup instructions below.
  2. If you are using one of the following fonts, refer to their guides for further instructions
  • Fontello
  • Icomoon

Setup

Refer to the guide for Expo, React Native or Web for further instructions.

Font location customisation

For fonts like the FontAwesome Pro as well as Fontello and Icomoon where you provide the fonts, the default location for the font files is rnvi-fonts in the same directory as your package.json. This can be customized by setting the fontDir property in your package.json file.

json
{
  "reactNativeVectorIcons": {
    "fontDir": "src/rnvi-fonts"
  }
}

Icon Component

You can either use one of the bundled icons above or roll your own custom font.

javascript
import { FontAwesomeFreeSolid } from "@react-native-vector-icons/fontawesome-free-solid";
// or use the static version to embed the font at build time instead of loading it at runtime
import { FontAwesomeFreeSolid } from "@react-native-vector-icons/fontawesome-free-solid/static";

<FontAwesomeFreeSolid name="rocket" size={30} color="#900" />;

Props

Any Text props and the following:

Prop Description Default
size Size of the icon, can also be passed as fontSize in the style object. 12
name What icon to show, see Icon Explorer app or one of the links above. None
color Color of the icon. Inherited

Styling

Since Icon builds on top of the Text component, most style properties will work as expected, you might find it useful to play around with these:

  • backgroundColor
  • borderWidth
  • borderColor
  • borderRadius
  • padding
  • margin
  • color
  • fontSize

By combining some of these you can create for example :

Usage as PNG Image/Source Object

Convenient way to plug this in into other components that rely on bitmap images rather than scalable vector icons.

You need to use Expo (with expo-font installed) or install @react-native-vector-icons/get-image to use this feature.

Both methods return an ImageResult object ({ uri, width, height, scale }) that can be passed directly as an Image source.

javascript
const source = Icon.getImageSourceSync('user', 20, 'red');
// or with an options object:
const source = Icon.getImageSourceSync('user', { size: 20, color: 'red', lineHeight: 28 });

return <Image source={source} />;

Alternatively you may use the async method Icon.getImageSource.

javascript
const source = await Icon.getImageSource('user', 20, 'red');
// or with an options object:
const source = await Icon.getImageSource('user', { size: 20, color: 'red' });

Keep in mind that Icon.getImageSourceSync is blocking and might incur performance penalties. Subsequent calls will use cache, however.

Static methods

All static methods from Icon are supported by multi-styled fonts.

Method Description
getImageSource Returns a promise resolving to an ImageResult of a bitmap version of the icon. Usage: const source = await Icon.getImageSource(name, { size, color, lineHeight })
getImageSourceSync Same as getImageSource but synchronous. Usage: const source = Icon.getImageSourceSync(name, { size, color, lineHeight })

Custom Fonts

The best approach is to use our icon generator to create your own icon package.

See CREATE_FONT_PACKAGE.md to learn how to create your own font packages.

You can also use createIconSet() directly in your project. This returns your own custom font based on the glyphMap where the key is the icon name and the value is either a UTF-8 character or its character code. postScriptName is the name of the postscript font. Open the font in https://fontdrop.info/, Font Book.app or similar to learn the name. Also pass the fontFileName argument for Android support.

javascript
import { createIconSet } from "@react-native-vector-icons/common";
const glyphMap = { "icon-name": 1234, test: "∆" };

// use createIconSet() with object parameter
// or use positional parameters for compatibility with version <= 10: `createIconSet(glyphMap, fontFamily[, fontFile])`
const Icon = createIconSet(glyphMap, {
  postScriptName: "FontName",
  fontFileName: "font-name.ttf",
  fontSource: require("../fonts/font-name.ttf"), // optional, for dynamic loading. Can also be a local file uri.
});

If you aren't using dynamic font loading you need to make sure your font is copied into your bundle.

Animation

React Native comes with an amazing animation library called Animated. To use it with an icon, simply create an animated component with this line: const AnimatedIcon = Animated.createAnimatedComponent(Icon). You can also use the higher level animation library react-native-animatable.

Dynamic icon font loading

TL;DR we recommend you use the /static import if you use Development builds and the root import when using Expo Go.

Icon fonts can be made available statically at build time or loaded dynamically at runtime. The root (non-/static) import uses dynamic loading. If you don't need dynamic loading, use the /static imports (e.g. "@react-native-vector-icons/ionicons/static").

See the Expo setup guide for more details, config plugins, and the dynamic loading API.

Usage Examples

Icon Explorer

Try the IconExplorer project in Examples/IconExplorer folder, there you can also search for any icon.

Basic Example

javascript
import { IonIcons } from "@react-native-vector-icons/ionicons/static";

const ExampleView = () => (
  <IonIcons name="ios-person" size={30} color="#4F8EF7" />
);

Inline Icons

javascript
import { Text } from "react-native";
import { IonIcons } from "@react-native-vector-icons/ionicons/static";

const ExampleView = (props) => (
  <Text>
    Lorem <IonIcons name="ios-book" color="#4F8EF7" /> Ipsum
  </Text>
);

Testing

When running tests with jest you will need to mock out the native code loading to prevent errors.

In jest.config.js add

javascript
// Mock out font loading
moduleNameMapper: {
  '\\.(ttf)$': '<rootDir>/__mocks__/file-mock.js',
}

Create __mocks__/file-mock.js:

javascript
module.exports = {};

Create __mocks__/@react-native-vector-icons/common.js:

javascript
// Mock the entire common library so there are no native module loading errors
module.exports = {
  createIconSet: () => "icon",
};

Changelog

License

This project is licenced under the MIT License.

Any bundled fonts are copyright to their respective authors and mostly under MIT or SIL OFL.

Issues· 19 open

View all issuesOpen on GitHub
  • #1888

    FA pro icons font files require specific names but this is not documented

    bugUpdated Aug 23, 2026
  • #1919

    npm install for split packages fails

    bugUpdated Aug 23, 2026
  • #1904

    [Directory] Add copy-to-clipboard when clicking an icon

    feature requestUpdated Apr 8, 2026
  • #1624

    react-native-macos: Not supported (help wanted)

    help wantedUpdated Sep 9, 2025
  • #1764

    [Feature]: If possible add some automation to the windows instructions similar to what we do on iOS

    Updated Jun 14, 2025
  • #1622

    Add Support for Google Material Symbols Icon Fonts

    help wantedfont requestUpdated May 12, 2025
  • #1736

    [Feature]: Improve CONTRIBUTING.md

    Updated Apr 10, 2025
  • #1677

    can u add solar icon set?

    font requestUpdated Mar 12, 2025
  • #1692

    [Feature]: Add Heroicons

    font requestUpdated Jan 12, 2025
  • #367

    Support web as a first class citzen

    Updated Jul 5, 2019

> Tags

TypeScripticonicon-packreact-nativeui

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架