1. react-favicon
React favicon helper
react-favicon
Package: react-favicon
Created by: oflisback
Last modified: Sun, 12 Mar 2023 18:33:47 GMT
Version: 2.0.3
License: MIT
Downloads: 117,290
Repository: https://github.com/oflisback/react-favicon

Install

npm install react-favicon
yarn add react-favicon

react-favicon

Control the favicon from a React app

Demo

http://oflisback.github.io/react-favicon

This example is available in example.

Installation

npm install react-favicon --save

Features

  • Update the favicon with a url or base64 encoded image
  • Animate through a list of urls
  • Toggle animation
  • Alert bubbles
  • Allow some favicons to be kept on the page, which may be desirable for desktop Safari
  • Custom icon overlay

Props

Name Type Default Required Description
alertCount number or string null No Number or string to display as icon overlay.
alertFillColor string red No Alert bubble background color.
alertTextColor string white No Alert bubble text color.
iconSize number 16 No Size of the favicon to avoid pixelization
animated boolean true No True to animate favicon (for supported icons)
animationDelay number 500 No Time between animation frames
keepIconLink function() () => false No Return true to remove icon link from document head
renderOverlay function(canvas, context) null No Function called to to draw custom favicon overlay
url string or array of strings Yes Favicon url or array of url:s to animate the icons

Usage

 <Favicon url={[url1, url2, url3]} />

See example for the demo page source code. Basic usage is as simple as importing the react-favicon package and including a Favicon component in the react component tree.

 import React from "react";
import ReactDOM from "react-dom";
import Favicon from "react-favicon";

ReactDOM.render(
  <div>
    <Favicon url="http://oflisback.github.io/react-favicon/img/github.ico" />
    <h1>Hello, Favicon!</h1>
  </div>,
  document.getElementById("root")
);

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code