fn
useFavicon
v0.0.15testeddemoReactive favicon.
Examples
ts
const favicon = useFavicon();
favicon.value = '/new-icon.png';ts
// Track an existing reactive source (read-only result)
const isDark = useDark();
const favicon = useFavicon(() => isDark.value ? '/dark.png' : '/light.png');Demo
Loading demo…
Signatures
ts
export function useFavicon(
newIcon: MaybeRefOrGetter<string | null | undefined>,
options?: UseFaviconOptions,
): ComputedRef<string | null | undefined>;ts
export function useFavicon(
newIcon?: MaybeRef<string | null | undefined>,
options?: UseFaviconOptions,
): Ref<string | null | undefined>;Parameters
| Parameter | Type | Description |
|---|---|---|
newIcon? | MaybeRefOrGetter<string | null | undefined> | Initial icon href. A getter or readonly ref yields a read-only `ComputedRef`; a writable ref or plain value yields a writable `Ref`. |
options? | UseFaviconOptions | Options |
Returns
UseFaviconReturnA ref bound to the favicon href