useFavicon 
Reactive favicon
Demo 
 Change favicon to 
Usage 
js
import { useFavicon } from '@vueuse/core'
const icon = useFavicon()
icon.value = 'dark.png' // change current iconPassing a source ref 
You can pass a ref to it, changes from of the source ref will be reflected to your favicon automatically.
js
import { useFavicon, usePreferredDark } from '@vueuse/core'
import { computed } from 'vue'
const isDark = usePreferredDark()
const favicon = computed(() => isDark.value ? 'dark.png' : 'light.png')
useFavicon(favicon)When a source ref is passed, the return ref will be identical to the source ref
ts
const source = ref('icon.png')
const icon = useFavicon(source)
console.log(icon === source) // trueType Declarations 
typescript
export interface UseFaviconOptions extends ConfigurableDocument {
  baseUrl?: string
  rel?: string
}
/**
 * Reactive favicon.
 *
 * @see https://vueuse.org/useFavicon
 * @param newIcon
 * @param options
 */
export declare function useFavicon(
  newIcon: ReadonlyRefOrGetter<string | null | undefined>,
  options?: UseFaviconOptions,
): ComputedRef<string | null | undefined>
export declare function useFavicon(
  newIcon?: MaybeRef<string | null | undefined>,
  options?: UseFaviconOptions,
): Ref<string | null | undefined>
export type UseFaviconReturn = ReturnType<typeof useFavicon>Source 
Contributors 
Changelog 
v10.5.0 on 10/7/2023v10.0.0-beta.5 on 4/13/2023cb644 - refactor!: remove isFunction and isString utilsv10.0.0-beta.4 on 4/13/20234d757 - feat(types)!: rename MaybeComputedRef to MaybeRefOrGetter10e98 - feat(toRef)!: rename resolveRef to toRef