--- layout: docs title: RetinaImg edit_url: "https://github.com/nylas/N1/blob/master/src/components/retina-img.cjsx" ---

Summary

RetinaImg wraps the DOM's standard <img> tag and implements a UIImage style interface. Rather than specifying an image src, RetinaImg allows you to provide an image name. Like UIImage on iOS, it automatically finds the best image for the current display based on pixel density. Given image.png, on a Retina screen, it looks for image@2x.png, image.png, image@1x.png in that order. It uses a lookup table and caches image names, so images generally resolve immediately.

RetinaImg also introduces the concept of image modes. Specifying an image mode is important for theming: it describes the content of your image, allowing theme developers to properly adjust it. The four modes are described below:

Class Properties

propTypes

React props supported by RetinaImg:

mode

(required) One of the RetinaImg.Mode constants. See above for details.

name Optional

A String image name to display.

url Optional

A String url of an image to display. May be an http, https, or nylas://<packagename>/<path within package> URL.

fallback Optional

A String image name to use when name cannot be found.

selected Optional

Appends "-selected" to the end of the image name when when true

active Optional

Appends "-active" to the end of the image name when when true

style Optional

An Object with additional styles to apply to the image.

resourcePath

(options) Changes the default lookup location used to find the images.