Appearance
useFavicon Composable ​
File Information ​
- Path:
app/composables/core/layouts/useFavicon.ts - Purpose: Keeps the browser tab favicon in sync with the brand portal's favicon URL
- Type: Core Composable (client-only)
Overview ​
useFavicon watches a reactive faviconUrl ref and updates the <link rel="icon"> DOM element whenever the URL changes. It is client-only — returns early on the server.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
faviconUrl | Ref<string> | ComputedRef<string> | Reactive URL of the brand favicon from appDataStore |
Behavior ​
- On mount (client only), watches
faviconUrlwith{ immediate: true } - On change: finds existing
<link rel="icon">or creates one and appends to<head> - Sets
link.hrefto the new favicon URL - No-ops when
hrefis empty
Usage Example ​
typescript
import { useFavicon } from '~/composables/core/layouts/useFavicon'
const faviconUrl = computed(() => appDataStore.portalData?.favicon_url ?? '')
useFavicon(faviconUrl)Related Documentation ​
- useCollageSidebar — sibling layout composable
- Composables Overview — all composables