Start a conversation

Adding Miscellaneous Assets to a React Component

A guide to assist you in adding images and other assets to your custom React components.

This guide describes the two supported methods for adding additional assets to a custom React component: manually via Git or through the GraphQL API.

Add an image file manually

To manually add a picture for usage in a component, place the image file in the assets subfolder of the component's directory.

For our example, we have added the image file named badge.png to the components/CatFactToast/assets directory.

Add an image file for a component via GraphQL

To upload an image file (or any type of asset) via GraphQL, use the saveComponentTemplateAssetFromUpload mutation. This mutation should be made as a multipart/form-data request with a file.

Here is an example cURL script that uploads an image file.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments