If you don't know how web app manifest files work, refer to the Add a Web App Manifest guide first.
Create React App (CRA) includes a web app manifest by default. Modifying this file will allow you to change how your application is displayed when installed on the user's device.
Why is this useful?
Web app manifest files provide the capability to change how an installed application will look like on a device home screen. By modifying properties in the JSON file, you can modify a number of details in your application, including its:
- App icon
- Theme color
The MDN documentation covers all the properties that can be changed in detail.
Modify the default manifest
In CRA, a default manifest file,
/public/manifest.json is included automatically when a new app is created:
"short_name": "React App",
"name": "Create React App Sample",
"sizes": "64x64 32x32 24x24 16x16",
This allows anybody to install the device to their home screen and see some
default details of the application. The HTML file,
<link> element to load the manifest.
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
Here is an example of an application built with CRA that has a modified manifest file:
To find out if all the properties are working correctly in this example:
- Mouse over the editor, press the App button, then press the Show button to preview the app.
- Open the DevTools by pressing
CMD + OPTION + i/
CTRL + SHIFT + i.
- Click on the Application panel.
- Switch to the Manifest tab.
- If you're building a site that you think does not need to be installed on a
device, remove the manifest and the
<link>element in the HTML file that points to it.
- If you would like users to install the application on their device, modify the manifest file (or create one if you are not using CRA) with any properties that you like. The MDN documentation explains all the required and optional attributes.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.