Skip to Content
ReactPro PackageInstall

React Pro Package

The Boxicons Pro React package provides over 50,000 icon variations as highly optimized, tree-shakable components. It’s the most efficient way to use Boxicons in modern React applications.

Installation

To access the Pro registry, you must first configure your .npmrc file with your API key. You can find your key in your Account Settings .

  1. Add the following to your .npmrc:
@boxicons-pro:registry=https://npm.boxicons.com/ //npm.boxicons.com/:_authToken=YOUR_API_KEY
  1. Install the main package:
# Using npm npm install @boxicons-pro/react # Using yarn yarn add @boxicons-pro/react # Using pnpm pnpm add @boxicons-pro/react

Ensure your API key remains secure. Avoid committing it directly to public repositories; consider using environment variables for CI/CD environments.


Quick Start

import { Alarm, Home, User } from '@boxicons-pro/react'; function App() { return ( <div> <Alarm size="lg" /> <Home weight="thin" color="#3b82f6" /> <User pack="filled" style="rounded" /> </div> ); }

Performance & Tree-Shaking

The package supports multiple import methods to suit your development and production needs.

Method 1: Named Imports (Best for DX)

Ideal for development. Modern bundlers (Vite, Webpack 5) will tree-shake unused icons in production, though initial dev build times may be slightly longer.

import { Alarm, Home } from '@boxicons-pro/react';

Method 2: Direct Imports (Best for cold-start performance)

Guarantees that only the code for the specific icon is loaded, bypassing the barrel file entirely.

import { Alarm } from '@boxicons-pro/react/icons/Alarm';

Method 3: Granular Packages (Best for bundle size)

If your project only uses a specific style (e.g., Rounded-Bold), you can install that variant specifically to minimize the dependency graph.

import { Alarm } from '@boxicons-pro/react-basic-rounded-bold';

Icon Packs

Boxicons Pro includes multiple icon packs:

PackDescription
basicSimple line icons (default)
filledSolid filled icons
duotoneTwo-tone icons with primary and secondary colors
duotone-mixDuotone icons with mixed styling
duotone-solidDuotone icons with solid styling
brandsBrand and logo icons
<Alarm pack="basic" /> <Alarm pack="filled" /> <Alarm pack="duotone" /> <Alarm pack="duotone-mix" /> <Alarm pack="duotone-solid" />

Styles

Each pack (except brands) supports three styles:

StyleDescription
regularDefault rounded corners
roundedMore pronounced rounded corners
sharpSharp, angular corners
<Alarm style="regular" /> <Alarm style="rounded" /> <Alarm style="sharp" />

Weights

Icons come in three weights:

WeightNameDescription
200thinLight, thin strokes
400normalDefault weight (no suffix needed)
700boldHeavy, bold strokes
// Using weight names <Alarm weight="thin" /> <Alarm weight="normal" /> // default <Alarm weight="bold" /> // Using numeric values <Alarm weight={200} /> <Alarm weight={400} /> <Alarm weight={700} />

Naming Convention

Icon names are converted from kebab-case SVG filenames to PascalCase:

SVG FileComponent Name
bx-alarm.svg<Alarm />
bx-alarm-clock.svg<AlarmClock />
bx-twitter.svg<Twitter />
bx-8-ball.svg<Icon8Ball />

Props Reference

Common Props

PropTypeDefaultDescription
pack'basic' | 'filled' | 'duotone' | 'duotone-mix' | 'duotone-solid' | 'brands''basic'Icon pack to use
style'regular' | 'rounded' | 'sharp''regular'Icon style variant
weight'thin' | 'normal' | 'bold' | 200 | 400 | 700'normal'Icon stroke weight
sizeIconSize'base'Preset size (see size table below)
widthnumber | string-Custom width (overrides size)
heightnumber | string-Custom height (overrides size)
fillstring'currentColor'Fill color
opacitynumber | string-Overall opacity (0-1)
flip'horizontal' | 'vertical'-Flip direction
rotatenumber | string-Rotation in degrees
removePaddingbooleanfalseRemove icon padding by adjusting viewBox
classNamestring-CSS class name
cssStyleReact.CSSProperties-Inline styles object

Duotone-specific Props

PropTypeDefaultDescription
primaryFillstring'currentColor'Primary layer fill color
primaryOpacitynumber | string1Primary layer opacity
secondaryFillstring'currentColor'Secondary layer fill color
secondaryOpacitynumber | string0.4Secondary layer opacity