Menu

Recipes

Without network requests

Save the icons you use to a file, add them with addIcons, and turn the hosts off:

Shell
curl -o src/icons/lucide.json "https://api.iconavo.dev/lucide.json?icons=heart,house,search"
JavaScript
import { addIcons, configure } from "@iconavo-ui/icon";
import lucide from "./icons/lucide.json";

addIcons(lucide);
configure({ api: [], cdn: [] });

Icons in your bundle also stay the same when the sets update. Whole sets come in the npm packages @iconavo-ui/icons-{set}, but they are large: from about 0.1 MB (Lucide) to 1.5 MB (Material Symbols) gzipped.

Next.js and server rendering

TSX
// app/layout.tsx is a Server Component
import { IconavoProvider, loadIcons } from "@iconavo-ui/react";

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const icons = await loadIcons(["lucide:house", "lucide:search"]);
  return (
    <html lang="en">
      <body>
        <IconavoProvider icons={icons}>{children}</IconavoProvider>
      </body>
    </html>
  );
}
TSX
// any Server or Client Component inside
import { Icon } from "@iconavo-ui/react";

<Icon icon="lucide:house" />;

loadIcons on the server

What your own host must serve

The simplest host is a caching reverse proxy to api.iconavo.dev and cdn.iconavo.dev. A self-hosted Iconify API answers batches too.

The full reference of our API, with the SVG and CSS addresses, is in the edge API documentation.

Edit this page on GitHub