You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7639005
Browse filesBrowse the repository at this point in the historyBrowse files
description: `How to use ${count}+ brand SVG icons in React, Vue, Svelte, React Native, plain HTML, the CLI, the REST API, and AI assistants via MCP. Best practices, tricks, and FAQ.`,
21
+
title: "Docs & Guides",
22
+
description: `How to use ${count}+ brand SVG icons in React, Vue, Svelte, React Native, plain HTML, the CLI, the REST API, and AI assistants via MCP. Recipes, best practices, tricks, migration guides, and FAQ.`,
description: `How to use ${count}+ brand SVG icons across every major framework, the CDN, the CLI, the REST API, and AI assistants.`,
41
+
title: "Docs & Guides",
42
+
description: `How to use ${count}+ brand SVG icons across every major framework, the CDN, the CLI, the REST API, and AI assistants. Recipes, best practices, and migration guides included.`,
label: "Nuxt 3 (explicit import, no auto-import config needed)",
104
+
format: "vue",
105
+
code: `<script setup>\n// @thesvg/vue is a plain npm package, not a Nuxt module -\n// import it like any other component, no nuxt.config changes required.\nimport { Github } from "@thesvg/vue";\n</script>\n\n<template>\n <Github width="24" height="24" />\n</template>`,
"Typed components for Svelte 4 and 5. Plain markup with no browser-only APIs, so it renders identically during SvelteKit SSR and in the client - no onMount guard or client-only wrapper needed.",
{label: "Search the catalog",format: "cli",code: `npx @thesvg/cli search "version control"`},
164
+
{
165
+
label: "In a Dockerfile / CI build step",
166
+
format: "cli",
167
+
code: `# Vendor icons at image build time instead of fetching them at runtime\nRUN npx --yes @thesvg/cli add github vercel nextjs --dir /app/public/icons`,
"A local MCP server (stdio) that gives Claude Desktop, Claude Code, and Cursor tools to search and fetch icons directly.",
193
+
"A local MCP server (stdio) that gives AI assistants tools to search and fetch icons directly. The same mcpServers JSON block works in any MCP-compatible client's config file (Claude Desktop, Claude Code, Cursor, Windsurf) - check your client's docs for where that config file lives.",
title: "Pin the jsDelivr mirror to a release, not @main",
194
-
body: "cdn.jsdelivr.net/gh/glincker/thesvg@main/... tracks the moving main branch. Pin to a released version (e.g. @3.3.8) in production so an upstream rename or removal can't silently change what your app renders.",
224
+
body: `cdn.jsdelivr.net/gh/glincker/thesvg@main/... tracks the moving main branch. Pin to a released git tag (e.g. @${JSDELIVR_PINNED_REF}, the current release) in production so an upstream rename or removal can't silently change what your app renders.`,
code: `// "/fallback-icon.svg" is a placeholder you provide - swap in a real\n// asset from your own public/ folder.\n<img\n src={\`https://thesvg.org/icons/\${slug}/default.svg\`}\n onError={(e) => {\n e.currentTarget.onerror = null; // stop if the fallback itself 404s\n e.currentTarget.src = "/fallback-icon.svg";\n }}\n alt={slug}\n/>`,
body: "A brand icon that's visible immediately on page load (a hero logo, an above-the-fold integration badge) benefits from a preload hint so the browser fetches it before it's needed, instead of waiting for the <img> tag to be discovered during layout.",
"A handful of known icons in a React, Vue, or Svelte app: use the matching framework package — it's tree-shaken and typed. An open-ended or large set (a picker, a directory): use the CDN <img> pattern instead, no bundle cost regardless of count. Want icons checked into your own repo: use the CLI.",
291
339
},
340
+
{
341
+
question: "My icon is showing a broken image / 404. What's wrong?",
342
+
answer:
343
+
"Almost always a slug mismatch — the URL path uses the exact slug from /api/registry.json, which isn't always the brand's display name (spaces, dots, and casing are normalized). Search the site or check the registry for the exact slug rather than guessing one from the brand name.",
344
+
},
345
+
{
346
+
question: "Does theSVG work with Next.js's <Image> component?",
347
+
answer:
348
+
"Not out of the box. Next's built-in image optimizer doesn't rasterize SVGs by default, so <Image> either needs the unoptimized prop for that image, or dangerouslyAllowSVG set on the domain in next.config. For most icon use cases a plain <img> tag (or a framework package component) is simpler and avoids the optimizer entirely.",
349
+
},
350
+
{
351
+
question: "Is there a TypeScript type listing every icon slug?",
352
+
answer:
353
+
"No exported union type of all slugs — each icon is its own named export (Github, Figma, ...), so importing an icon that doesn't exist is a module-not-found error at build time, not a string-literal type error. If you need slugs as data (e.g. from an API response), registry.json's slug field is a plain string.",
354
+
},
355
+
{
356
+
question: "How is theSVG different from Simple Icons, svgl, or Iconify?",
357
+
answer:
358
+
"Short version: theSVG has more brand icons with more variants per icon (color, mono, light, dark, wordmark) and a wider toolchain (framework packages, CLI, REST API, MCP server). Simple Icons is mono-only but has years of community trust; svgl is Svelte-focused with no npm package; Iconify aggregates 150+ icon sets but isn't brand-focused. Full side-by-side comparison at /compare.",
359
+
},
360
+
{
361
+
question: "Do the framework packages support server-side rendering (SSR)?",
362
+
answer:
363
+
"Yes. Every framework package (@thesvg/react, @thesvg/vue, @thesvg/svelte) renders plain markup with no browser-only APIs, so they're SSR-safe by default - no client-only wrapper or hydration guard needed. @thesvg/react components specifically work as React Server Components with no \"use client\" directive.",
364
+
},
365
+
{
366
+
question: "Can I self-host the icons without crediting theSVG?",
367
+
answer:
368
+
"The codebase and tooling are MIT-licensed, so no attribution is legally required to self-host. The brand marks themselves stay the property of their trademark holders regardless of where you host the files — see /legal. A link back is appreciated but not required.",
369
+
},
370
+
{
371
+
question: "Why does the same icon look different in dark mode?",
372
+
answer:
373
+
"If you're rendering the default variant everywhere, that's expected - it's a fixed brand color, not theme-aware. For a variant that adapts to the page theme, use light/dark with a <picture> element (see Best practices above), or the mono variant with an inline component so it inherits currentColor.",
0 commit comments