npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@whydrf/nava-icon-react

v1.5.0

Published

React components for Nava Icons

Readme


What is this?

@whydrf/nava-icon-react is the React binding for Nava Icons — a collection of 950+ handcrafted SVG icons. Each icon is a native React component with full TypeScript support, tree shaking, and two visual variants (regular outlines and filled shapes).

Unlike icon fonts or SVG sprites, every icon here is a proper React component. You import it, use it with JSX props, and your bundler eliminates anything you didn't import.

Installation

npm install @whydrf/nava-icon-react

Requirements: React 18 or later. Works with both the App Router and Pages Router in Next.js.

Getting Started

After installation, import the icons you need by name. Every icon follows the pattern {IconName}Icon in PascalCase:

import { HomeIcon, SearchIcon, SettingsIcon } from '@whydrf/nava-icon-react'

export function Navigation() {
  return (
    <nav>
      <HomeIcon size={24} />
      <SearchIcon size={24} color="gray" />
      <SettingsIcon size={24} />
    </nav>
  )
}

That's it — no setup required. Just import and use. For setting default props across your app, see Global Configuration.

How Tree Shaking Works

This is the most important concept to understand. When you write:

import { HomeIcon } from '@whydrf/nava-icon-react'

Your bundler (webpack, Vite, Rollup, esbuild) traces this import and includes only the HomeIcon component in your production bundle. The other 949 icons are completely eliminated. This is why static imports are strongly recommended.

In contrast, this pattern imports everything:

// ❌ Don't do this in production — bundles all 950+ icons
import * as Icons from '@whydrf/nava-icon-react'

If you need to render icons dynamically (e.g., the icon name comes from a database or user input), use the Icon component instead. It's designed for that specific use case and clearly documents the bundle size trade-off.

Two Variants: Regular and Filled

Every icon in the library ships in two visual styles:

  • Regular — Stroke-based outlines. Clean, minimal, and ideal for most UI contexts like navigation, toolbars, and forms.
  • Filled — Solid shapes with filled regions. Great for emphasis, active states, or when you want an icon to stand out.

You control which variant to show with the mode prop:

import { CheckCircleIcon, HeartIcon } from '@whydrf/nava-icon-react'

function StatusIndicator({ isComplete }: { isComplete: boolean }) {
  return (
    <div>
      {/* Show a filled heart when liked, outline when not */}
      <HeartIcon
        size={24}
        mode={isComplete ? 'filled' : 'regular'}
        color={isComplete ? 'red' : 'gray'}
      />

      {/* Always show filled for completed tasks */}
      <CheckCircleIcon size={24} mode="filled" color="green" />
    </div>
  )
}

The mode switching is instant — no re-fetching, no lazy loading. Both variants are bundled together.

The Dynamic Icon Component

Sometimes you can't use static imports. Maybe the icon name comes from an API, a database, or user configuration. For these cases, the package exports a dynamic Icon component:

import { Icon } from '@whydrf/nava-icon-react'

// The name prop accepts kebab-case strings
<Icon name="home" size={24} />
<Icon name="check-circle" mode="filled" color="green" />
<Icon name="arrow-right" size={16} />

Important: The Icon component imports all icons internally, so it cannot be tree-shaken. Your bundle will include all 950+ icons. Use it only when static imports aren't feasible.

Customizing Appearance

Since icons are standard SVG elements, you can customize them with CSS and standard React props:

<HomeIcon
  size={32}
  color="#6366f1"
  strokeWidth={1}
  className="icon-hover"
  style={{ transition: 'transform 0.2s', cursor: 'pointer' }}
  onClick={() => navigate('/')}
  aria-label="Go to homepage"
/>

The className and style props work exactly like any HTML element. You can target icons with CSS selectors, add transitions, animations, or theme them with CSS variables.

Colors

You can pass colors in any format the browser understands — hex codes, RGB, HSL, named colors, or CSS variables:

<HomeIcon color="#1a1a2e" />           {/* Hex */}
<HomeIcon color="rgb(99, 102, 241)" /> {/* RGB */}
<HomeIcon color="oklch(65% 0.27 264)" /> {/* OKLCH */}
<HomeIcon color="var(--primary)" />    {/* CSS variable */}

With Tailwind CSS, wrap the icon in a utility class and use currentColor:

// The color prop defaults to currentColor, so Tailwind's text-* utilities work directly
<HomeIcon className="text-blue-500" />

// Combine color, size, and hover effects
<HomeIcon className="text-emerald-400 w-8 h-8 hover:text-emerald-300 transition-colors" />

// Dark mode support
<HomeIcon className="text-gray-900 dark:text-white" />

Global Configuration

Instead of passing the same props to every icon, wrap your app with NavaIconProvider to set defaults once. All Icon components and static icon imports within the provider will inherit these values.

import { NavaIconProvider, HomeIcon, SearchIcon } from '@whydrf/nava-icon-react'

function App() {
  return (
    <NavaIconProvider size={20} color="gray" strokeWidth={1.5}>
      <HomeIcon />              {/* size=20, color="gray", strokeWidth=1.5 */}
      <SearchIcon size={24} />  {/* size=24 overrides provider — color and strokeWidth inherited */}
    </NavaIconProvider>
  )
}

Props always override provider values. If you pass size={32} to an icon, that takes priority over the provider's size.

You can also use the useNavaIconConfig hook to read the current configuration:

import { useNavaIconConfig } from '@whydrf/nava-icon-react'

function DebugConfig() {
  const config = useNavaIconConfig()
  return <pre>{JSON.stringify(config)}</pre>
}

Accessibility

Icons include built-in accessibility features:

  • When you provide a title prop, an invisible <title> element is added inside the SVG, which screen readers announce.
  • Decorative icons (no title) are implicitly aria-hidden since SVGs without titles are ignored by assistive technology.
// Meaningful icon — screen reader announces "Go to homepage"
<HomeIcon title="Go to homepage" />

// Decorative icon — screen reader ignores it
<HomeIcon />

Server-Side Rendering

Nava Icons works with SSR out of the box. Icons are rendered as regular HTML/SVG elements — there's no client-side JavaScript required to display them.

Next.js App Router (Server Components)

// This works in a Server Component — no 'use client' needed
import { HomeIcon } from '@whydrf/nava-icon-react'

export default function Page() {
  return <HomeIcon size={24} />
}

Next.js Pages Router

// Works in both getServerSideProps and regular components
import { HomeIcon } from '@whydrf/nava-icon-react'

export default function Page() {
  return <HomeIcon size={24} />
}

TypeScript

The package includes full TypeScript definitions. You get autocompletion for icon names and type checking for all props:

import type { IconName, IconMode, IconProps } from '@whydrf/nava-icon-react'

// IconName gives you autocompletion for all 950+ icon names
const icon: IconName = 'home'    // ✅ valid
const bad: IconName = 'invalid'  // ❌ compile error

// IconMode constrains to 'regular' | 'filled'
const mode: IconMode = 'filled'  // ✅

// IconProps for extending the component
function CustomIcon(props: IconProps) {
  return <HomeIcon {...props} />
}

Props Reference

| Prop | Type | Default | Description | |------|------|---------|-------------| | size | number \| string | 24 | Width and height in pixels | | color | string | currentColor | SVG stroke/fill color. currentColor inherits from parent CSS | | strokeWidth | number \| string | 0.5 | Controls line thickness for stroke-based icons | | mode | "regular" \| "filled" | "regular" | Toggles between outline and solid variants | | title | string | — | Accessible title for screen readers | | className | string | — | CSS class name | | style | CSSProperties | — | Inline styles |

All standard SVG attributes (onClick, onMouseEnter, data-*, aria-*, etc.) are also supported.

Popular Icons

| Category | Icons | |----------|-------| | Arrows | arrow-back, arrow-right, arrow-from-left, arrow-to-top, refresh, redo, undo | | Interface | home, search, settings, menu, check-circle, x-circle, copy, trash | | Communication | bell, mail, phone, message-square, send, at | | Files | file, folder, download, upload, archive, clipboard | | Media | camera, image, music, video, play, pause | | Objects | star, bookmark, lock, key, award, gift | | Weather | sun, moon, cloud, droplet, wind, umbrella | | Shopping | cart, credit-card, bag, tag, badge, diamond |

Browse all 950+ icons with live preview at nava-icons.dev.

Comparing with Alternatives

| | Nava Icons | react-icons | Heroicons | Lucide | |---|---|---|---|---| | Icons | 950+ | 5000+ | 300+ | 1500+ | | Variants | Regular + Filled | Varies by set | Outline + Solid | Stroke only | | Tree shaking | ✅ Full | ✅ Full | ✅ Full | ✅ Full | | TypeScript | ✅ | Partial | ✅ | ✅ | | Dynamic API | ✅ | ✅ | ❌ | ❌ | | SSR | ✅ | ✅ | ✅ | ✅ |

Nava Icons strikes a balance between quantity and quality — every icon is designed with the same visual language, so your UI stays consistent.

License

MIT © whydrf