Loading...
Every setup starts the same way: use an existing React or React Native project, initialize Rocketicons at its root, then add an exact icon ID. TypeScript and JavaScript projects are supported.
Import the generated component through the alias added to tsconfig.json:
Your build tool must understand the @ alias. If it does not read TypeScript paths automatically, mirror that alias in its configuration.
Run the commands from the directory containing next.config.* and tsconfig.json. Next.js reads TypeScript path aliases, so the generated import can be used in a Server or Client Component wherever its surrounding code allows.
Run the commands beside vite.config.*. Keep the generated @/ri/* TypeScript path and configure Vite's @ alias if your starter does not already provide it.
Start with an Expo TypeScript or JavaScript project and set up NativeWind as described in the React Native section below before initializing. Metro must resolve your @ alias.
Rocketicons uses its generated native core with react-native-svg and styles icons through NativeWind 4. NativeWind 4 compiles with Tailwind CSS 3, so React Native registers the Rocketicons plugin in tailwind.config.js, not with the web @plugin line.
Install NativeWind 4, react-native-svg, and tailwindcss@^3.4. Then configure these files:
In a React Native CLI app without Expo, add "nativewind/babel" to your existing Babel presets and wrap the config from @react-native/metro-config with withNativeWind, as shown in NativeWind's framework-less guide.
npx rocketicons init adds the nativeIconPlugin entry to an existing tailwind.config.* file in CommonJS, ESM, or TypeScript, and --dry-run shows that edit first. Run npx rocketicons doctor --json to check the Tailwind CSS version, the NativeWind preset and Rocketicons plugin, the imported stylesheet, withNativeWind in Metro, and the Babel preset.
If Babel reports Cannot find module 'react-native-worklets/plugin' in an app on Reanimated 3, upgrade to [email protected] or newer.
Render the generated component with icon classes:
The CLI installs
nativewindandreact-native-svgwhen they are missing and registers the plugin. It does not install Tailwind CSS, create the NativeWind, Babel, or Metro files, or configure alias resolution. NativeWind 5, which uses Tailwind CSS 4, is not configured automatically yet.