DocsShowcaseGitHub
IntroductionReactMorphingLine, Fill and DuoSVGAccessibilityDesignRoadmapChangelog
Get started
  • Introduction
Guides
  • React
  • Morphing
  • Line, Fill and Duo
  • SVG
  • Accessibility
  • Design
Project
  • Roadmap
  • Changelog

React

Previous: IntroductionNext: Morphing

Import paths, names, props and types for @nubo-icons/react.

@nubo-icons/react has one component per icon per style. It works with React 18 and 19, ships ES modules and CommonJS with types for both, and only the icons you import end up in your bundle.

Import paths#

Each style has its own entry point. The names are the same in all three, so switching style is a one-line change.

StyleImport from
Line@nubo-icons/react or @nubo-icons/react/line
Fill@nubo-icons/react/fill
Duo@nubo-icons/react/duo

To use two styles in one file, rename one of them:

import { BellIcon } from "@nubo-icons/react";
import { BellIcon as BellFillIcon } from "@nubo-icons/react/fill";
 
<span>{unread ? <BellFillIcon /> : <BellIcon />}</span>;

Names#

Icon names are kebab-case on the site (magnifying-glass) and PascalCase in code. Every icon is exported twice, with and without an Icon suffix:

import { MagnifyingGlass, MagnifyingGlassIcon } from "@nubo-icons/react";

Icons also export their aliases: the names other sets use for the same thing. Search, Home and Settings all work, so moving from Lucide is mostly a find-and-replace. Each icon's aliases are listed in its drawer on the site.

Props#

PropDefaultNotes
size24Width and height. Any number or CSS length, such as 18 or "1em".
strokeWidth1.5Stroke width in grid units, so it scales with size.
colorinheritedIcons draw in currentColor, so they follow the text color unless you set one.
titlenoneMakes the icon announced to screen readers. See Accessibility.
secondaryOpacity0.3Duo only: the strength of the tint.
mirroredautoFlips the icon. See right-to-left layouts.

Every other SVG prop passes through, including className, style, event handlers and ref.

Fill and Duo are drawn for the 1.5px stroke. Changing strokeWidth on them also thickens their outlines, which can close the small gaps between parts. Keep custom stroke widths to Line.

Styling#

Every icon has the classes nubo-icon and nubo-<name>, so you can style one icon or all of them:

<HeartIcon className="size-5 text-rose-500" />
.nubo-icon {
  flex-shrink: 0;
}

Size follows the size prop, but CSS width and height win if you set them, which makes utility classes like size-5 work as expected. Use size="1em" to scale an icon with the text around it.

Morphing#

MorphIcon from @nubo-icons/react/morph animates between related icons, like menu to x. See Morphing.

TypeScript#

Every icon has the type NuboIcon, and its props are IconProps. Both are exported from each entry point.

import type { IconProps, NuboIcon } from "@nubo-icons/react";
 
type NavItem = { label: string; icon: NuboIcon };
 
function Glyph({ icon: Icon, ...props }: { icon: NuboIcon } & IconProps) {
  return <Icon {...props} />;
}
IntroductionMorphing

On this page

  • Import paths
  • Names
  • Props
  • Styling
  • Morphing
  • TypeScript
Edit this pageBack to top