Why Customize Logo API Fallbacks?
Logo API includes built-in fallback options, but some applications need more control over how missing logos appear. A custom fallback is useful when you want to display:- Company initials
- A default brand icon
- A custom placeholder image
- A lettermark
- A styled fallback card
- A loading state before the logo appears
Enhanced Fallback Mechanism
The React example below combines Logo API with loading state, error handling, and a custom fallback UI.How It Works
- The component starts by showing a transparent placeholder while the logo is loading.
- If Logo API successfully returns the company logo, the image is displayed inside your UI.
-
If the logo is not found, the CDN returns a 404 response because the URL uses:
/fallback/404/icon -
When the image fails to load, React triggers the
onErrorevent and shows your custom fallback UI instead.
Key Considerations
Initial Loading State
Use a transparent 1x1 pixel image as the initial placeholder. This prevents the browser from showing a broken image icon while the logo request is still loading.Error Handling
Use the imageonError event to detect when a logo cannot be loaded.
When an error occurs, display your custom fallback UI, such as initials, a generic icon, or a branded placeholder.
Logo API Parameters
Use the Logo API 404 fallback option when you want your frontend to control the fallback experience. Example URL:Alt Text
Always use descriptive alt text for accessibility and SEO. Instead of using generic alt text, include the brand or domain name when possible. Example:Best Use Cases
Custom Logo API fallbacks are useful for applications that display many company logos, such as:- CRM platforms
- SaaS dashboards
- Marketplaces
- Finance apps
- Transaction feeds
- Company directories
- Search result pages
- Lead enrichment tools
