Installation
npx shadcn@latest add @iconiq/favicon-badgeProps
FaviconBadge
Inline circular badge that resolves a website favicon from a domain or URL, with an optional text label and spring entrance animation.
websitestringRequired
labelstringfaviconSize16 | 32 | 64 | 128Default 64
size"sm" | "md" | "lg"Default "md"
classNamestringbadgeClassNamestringlabelClassNamestringExtends native `span` props (`id`, `onClick`, `data-*`, and other `aria-*` attributes) via prop spreading on the root.
Favicons are resolved from Google and DuckDuckGo icon services after `extractDomain` normalizes the `website` value.
The component preloads favicons with cancellation-safe `Image()` requests and falls back through multiple providers before showing the `Globe` placeholder.
When `label` is omitted, the root uses `role="img"` with an `aria-label` derived from the label, domain, or raw `website` value.
Exports `extractDomain`, `getFaviconUrl`, and `FaviconBadgeSize` for reuse in search fields or attribution rows.
Install path is `components/ui/favicon-badge.tsx` with named and default `FaviconBadge` exports. Requires `@/lib/utils` (`cn`).
Registry bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: motion, lucide-react.
Requires the local `cn` helper from `@/lib/utils`, which is included in a standard shadcn setup.