Next.js
Use AXIcons in the Next.js App Router, in Server and Client Components, with no configuration.
Install
pnpm add @axcore/xicons-reactNo next.config changes are needed: the package is standard ES modules.
Server Components
Icon components use no hooks and no browser APIs, so they render in Server Components without "use client". The SVG arrives in the HTML and adds no client JavaScript.
import { IconArrowRight } from "@axcore/xicons-react";
import Link from "next/link";
export default function Page() {
return (
<Link href="/docs" className="inline-flex items-center gap-1.5">
Read the docs <IconArrowRight size={16} />
</Link>
);
}Client Components
Inside a Client Component, icons work the same way. Only the icons that component imports join its client bundle.
"use client";import { useState } from "react";import { IconHeart, IconHeartFilled } from "@axcore/xicons-react";export function LikeButton() { const [liked, setLiked] = useState(false); const Icon = liked ? IconHeartFilled : IconHeart; return ( <button aria-pressed={liked} aria-label="Like" onClick={() => setLiked(!liked)}> <Icon className="size-5 text-rose-600" /> </button> );}Tested here
Something wrong or missing?Open an issue