Prerequisites
- A shadcn/ui project with Tailwind CSS v4
- A Brandfetch account with an active client ID
Quickstart
1
Install the components
Install everything, or only the component you need:Each component also installs a shared helper,
lib/brandfetch.ts.2
Add your credentials
The CLI adds the variables to
.env.local. Fill them in:.env.local
3
Render a logo
Components
To install one component, put its name in the URL:https://brandfetch.com/r/<name>.json.
Logo
Shows one asset from the Logo API. Look a brand up by domain, ticker, ISIN or crypto symbol:type and the component tries each one in order:
Logo props
Logo props
icon is the square app icon, symbol the bare mark, logo the wordmark. Pass a list to try in order.auto follows your app’s dark mode. Defaults to auto for symbols and wordmarks.Shown when the brand has no asset:
lettermark, brandfetch, transparent, initials, none, or your own element.Logo Avatar
Shows a brand icon in a shadcn Avatar, with the brand’s initials while it loads.LogoAvatarGroup shows the first max icons and a +N count for the rest.
Logo Avatar props
Logo Avatar props
Brand Search
A company autocomplete built on the shadcn Combobox and the Brand Search API. It runs in the browser with your client ID, so you don’t need an API route.Brand Search props
Brand Search props
Called with the picked brand (
name, domain, icon, brandId), or null when cleared.Logo Wall
A grid of customer or partner logos, balanced by area. A brand with no wordmark falls back to its symbol, then its icon.Logo Wall props
Logo Wall props
Logo Marquee
The same logos in a looping strip. It pauses on hover and stays still when reduced motion is on.Logo Marquee props
Logo Marquee props
Brand Card
A company’s banner, icon, name and description, with optional colors, fonts and links. The data comes from the Brand API, which needs your secret API key, so fetch it on the server withgetBrand():
BrandCardSkeleton as the Suspense fallback.
Brand Card props
Brand Card props
Helpers
lib/brandfetch.ts also works on its own:
Usage rules
The components follow these rules. Keep them if you edit the code:- Load logos from
cdn.brandfetch.ioin an<img>tag. Don’t download, proxy or re-host them. See hotlinking. - Use Brand Search results for autocomplete only. Don’t store them.
- Keep
BRANDFETCH_API_KEYon the server. Never importgetBrand()into client code.
FAQ
Do I need Next.js?
Do I need Next.js?
No. Outside Next.js, the
NEXT_PUBLIC_ variable isn’t read automatically, so pass your client ID with the clientId prop.How do I update the components?
How do I update the components?
Run the same
add command again. The CLI asks before it overwrites existing files.Do I need to show attribution?
Do I need to show attribution?
No. The Logo API and Brand Search API are free and don’t require attribution.
Why do I see the Brandfetch placeholder instead of a logo?
Why do I see the Brandfetch placeholder instead of a logo?
The brand has no asset of the type you asked for. Pass a list to
type, or set fallback to initials.