Before you start
- Node.js 18 or later, because the CLI uses the built in
fetch. - A project folder to add files to.
Copy a file or import a package
Copying suits a handful of logos you want to own: a file in your repository with no runtime package behind it. If you want every logo behind one typed import instead, use a component package for React or for Vue and Svelte.
Find and add logos
Step 1Find the slug
Every logo has a slug. Search by brand name, slug or keyword, and quote a search with spaces.
--limitshows more than the first results.bash npx @thesvg/cli search github npx @thesvg/cli search "version control" --limit 30Step 2Browse a category
listshows logos from the registry, optionally narrowed to one category.bash npx @thesvg/cli list --category AI --limit 100Step 3Add a logo
With no flags,
addsaves the default variant as an SVG file. It picks the folder from your project:./public/iconswhen apublicfolder exists, else./src/iconswhen asrcfolder exists, else./icons.bash npx @thesvg/cli add githubStep 4Add several at once, into your own folder
Pass several slugs in one call, and
--dirto choose the output folder. The folder is created if it does not exist.bash npx @thesvg/cli add github figma stripe --dir ./src/assets/iconsStep 5Pick a variant
--varianttakesdefault,light,dark,monoorwordmark. The file name carries the variant, so the dark GitHub mark lands asgithub-dark.svg. If a brand does not have the variant you asked for, the CLI says so, lists the ones it has, and falls back todefault.bash npx @thesvg/cli add github --variant darkStep 6Write a React or Vue component instead
--format jsxwrites a typed React component in a.tsxfile, and--format vuewrites a single file component with the SVG in its template.bash npx @thesvg/cli add github --format jsx --dir ./components/icons npx @thesvg/cli add github --format vueStep 7Install it for repeated use
npxruns the CLI without installing it. If you add logos often, install it globally and callthesvgdirectly.bash npm install -g @thesvg/cli thesvg add github
What a component file looks like
With --format jsx, github.tsx exports GithubIcon, a component typed with the standard SVG props, wrapped around the logo markup. The generated <svg> does not spread those props yet, so add {...props} to it once if you want to pass className or aria-label from the call site.
import type { SVGProps } from "react";
export function GithubIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg viewBox="...">{/* the logo paths */}</svg>
);
}
export default GithubIcon;