What every package has in common: the five styles, how size and colour work, stroke width, and accessibility. Examples are React; each package page shows its own spelling. For whole components built with icons, see Examples.
Every icon is drawn five times. A style is one variant value:
| Style | React variant |
Vue, Svelte, React Native variant |
What it draws |
|---|---|---|---|
| Outline | "Outline" (default) |
"outline" (default) |
Linework at 1.5 |
| TwoTone | "TwoTone" |
"twotone" |
The same lines, secondary parts at 40% |
| Bold | "Bold" |
"bold" |
A heavier form of the same glyph |
| Bulk | "Bulk" |
"bulk" |
Bold, secondary parts at 40% |
| Broken | "Broken" |
"broken" |
The outline opened by small gaps |
import { IconHeart } from "@devigner-ui/icons/Heart";
<IconHeart className="size-6" />
<IconHeart variant="TwoTone" className="size-6" />
<IconHeart variant="Bold" className="size-6" />
<IconHeart variant="Bulk" className="size-6" />
<IconHeart variant="Broken" className="size-6" />Changing variant changes the weight, never the shape: every style draws the
same symbol.
There is no size or color prop on the web packages. Size and colour are
CSS: icons paint with currentColor, so they take the text colour around
them.
<IconHeart className="size-8" />
<IconHeart className="size-6 text-rose-600" />React Native has no CSS cascade, so its package takes size and color props
instead; see React Native.
strokeWidth sets the line weight of Outline, TwoTone and Broken, in the 24px
drawing's own units. The default is 1.5.
<IconHeart strokeWidth={1} className="size-6" />
<IconHeart strokeWidth={2} className="size-6" />Bold and Bulk have a fixed weight, so strokeWidth leaves them as they are.
An icon is decorative by default: it renders aria-hidden="true" (in React
Native, hidden from accessibility services), because an icon beside its own
text label would otherwise be announced twice. Give it a label when it is the
only thing that says what a control does, and it becomes an image:
<button>
<IconTrash className="size-4" /> {/* hidden: the word is the label */}
Delete
</button>
<button>
<IconTrash aria-label="Delete" className="size-4" /> {/* role="img" */}
</button>Besides variant and strokeWidth, every prop or attribute reaches the
<svg>: onClick, style, id, data-* and the aria attributes. In React
the ref reaches it too, so an icon works as a tooltip or popover trigger.
For a known handful of icons, write the map out. It is the version that tree shakes:
import { IconShoppingCart } from "@devigner-ui/icons/ShoppingCart";
import { IconUser } from "@devigner-ui/icons/User";
import type { IconComponentType } from "@devigner-ui/icons";
const ICONS = {
cart: IconShoppingCart,
account: IconUser,
} satisfies Record<string, IconComponentType>;
function NavIcon({ name }: { name: keyof typeof ICONS }) {
const Icon = ICONS[name];
return <Icon className="size-5" />;
}To reach any of the 2,496 icons by a string, import the whole namespace and accept that nothing tree shakes. The TypeScript page shows how to keep that type-safe.
metadata.json describes every icon: its category, keywords, styles, and the
names it used to have.
import metadata from "@devigner-ui/icons/metadata.json";
const icon = metadata.icons.find((i) => i.name === "BagStraps");
icon.category; // "shopping-ecommerce"
icon.freeStyles; // ["outline", "twotone", "bold", "bulk", "broken"]
icon.formerly; // ["Bag2"]Every style of every icon is free; see Licensing.