DocsFrameworksReact and Next.js
React and Next.js
One component, no state and no effects, so it renders on the server too.
npm install fidgiconspnpm add fidgiconsyarn add fidgiconsimport 'fidgicons/css';
import { Fidgicon } from 'fidgicons/react';
import battery from 'fidgicons/icons/battery.js';
import bell from 'fidgicons/icons/bell.js';
export function Status({ level }) {
return (
<>
<Fidgicon icon={battery} value={level / 100} aria-label={level + '% charged'} />
<button className="fidg-hover">
<Fidgicon icon={bell} /> Notify me
</button>
</>
);
}#Next.js
Import the stylesheet once in app/layout.js. The component renders a plain <svg>, so it works in server components and static export.
import 'fidgicons/css';
export default function RootLayout({ children }) {
return <html lang="en"><body>{children}</body></html>;
}#Paid icons
Let the CLI write them as modules into your project, then import them like the free ones.
npx fidgicons add lechon kalesa --out src/icons --jsimport lechon from '@/icons/lechon.js';
<Fidgicon icon={lechon} hover />All options are on the reference page. className and style are merged with the icon's own.
Something missing or unclear?Write to usRequest an icon