# @s-ui/react-atom-image

> AtomImage is a component that loads an image inside, maintaining all the accesibility attributes. This component can be set to show a placeholder image, a skeleton and/or a spinner while the final image is being loaded. This component will also show an Er

Latest version **2.18.0** (published 2025-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @s-ui/react-atom-image
pnpm add @s-ui/react-atom-image
yarn add @s-ui/react-atom-image
bun add @s-ui/react-atom-image
```

## Health

**Score 35/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.18.0 |
| Published | 2025-07-24 |
| First published | 2018-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 146 |
| Maintainers | alejandro.ferrante, ivanmlaborda, salvador.juan, andresin87.adevinta, izeller, gfabregoadv, a.ferrer, ignacio_navarro, oscar_ramirez, jordi.munoz, joanleon-adv, aitor.rodriguez, luis-garrido, jenifer.lopez, isabelgomez87, pa.chruscinski.ext, schibstedspain, alfredo.arronte, belen.santos, xavi_ballestar, ferrangbtw, jamile.radloff, davidmartin2108, sergi.quintela, estefania_garcia, carlosvillu-adevinta, miriam-gil, arnau.guell, ferran.simon, victor.perez.adevinta, mariapaula.forero.ext, oscar.gomez, david.nieto, oriol.puig, nacho_torrella, xavi.murcia, ignacio.rodriguez, francisco.ruiz.lloret, sziauberyte, alfredo.zimperz, andresadv, javiauso, alverd004, marian.lucaci, pablogs, alisa_bayanova, cristhianb, sergiocollado, pablo.rey-adevinta, beatrizip, alex.castells, david.cuadrado.ext, giovanny.sayas.ext, patricio.sartore, azahara, marc.benito, sergio.escano, cristina.rodriguez.duque, pol.valls, frandelacasa-adevinta, carolina.mallo.ext, daniel.perez.ext, hpintos_adevinta, carlos.gonzalezl, albert.peiro, oscar-raig-adevinta, thomas.page.ext, sebastian.badea.adevinta, victoria.pasichnyk.ext, sendami.luque.ext, luz_adv, alfredo.narvaez, ruben-martin, dann41, emiliovz, adria.velardos, arturo.vicente, diegomr, sergi.martinez.adevinta, guillemgc3, frontend-jobs, javiermiguel, atilioscolaroadv, crotundu.adevinta, candymd, florinz, denis_z, anya_ok, hector-prieto-moreno |
| Keywords | @s-ui, react, component, atom, image |

## Links

- npm: https://www.npmjs.com/package/@s-ui/react-atom-image
- Repository: https://github.com/SUI-Components/sui-components
- Homepage: https://sui-components.vercel.app/
- Issues: https://github.com/SUI-Components/sui-components/issues?q=is%3Aopen+label%3A%22Component%3A+image%22
- npm.io page: https://npm.io/package/@s-ui/react-atom-image

## Dependencies (3)

- [@s-ui/component-dependencies](https://npm.io/package/@s-ui/component-dependencies.md) 1
- [@s-ui/react-primitive-injector](https://npm.io/package/@s-ui/react-primitive-injector.md) 1
- [@s-ui/react-primitive-polymorphic-element](https://npm.io/package/@s-ui/react-primitive-polymorphic-element.md) 1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.18.0 (latest) — 2025-07-24
- 2.17.0 — 2025-06-03
- 2.16.0 — 2022-10-03
- 2.15.0 — 2022-10-01
- 2.14.0 — 2022-09-29
- 2.13.0 — 2022-07-18
- 2.12.0 — 2022-07-18
- 2.11.0 — 2022-06-20
- 2.10.0 — 2022-01-11
- 2.9.0 — 2021-07-12
- 2.8.0 — 2021-02-10
- 2.7.0 — 2020-12-22
- 2.6.0 — 2020-12-07
- 2.5.0 — 2020-12-07
- 2.4.0 — 2020-11-24
- … 13 more at https://npm.io/package/@s-ui/react-atom-image/versions

## README

# AtomImage

AtomImage is a component that loads an image inside, maintaining all the accesibility attributes. This component can be set to show a placeholder image, a skeleton and/or a spinner while the final image is being loaded. This component will also show an Error Box if the image could't be loaded

[![documentation](https://img.shields.io/badge/read%20the%20doc-black?logo=readthedocs)](https://sui-components.vercel.app/workbench/atom/image/)
[![issue](https://img.shields.io/badge/report%20a%20bug-black?logo=openbugbounty&logoColor=red)](https://github.com/SUI-Components/sui-components/issues/new?&projects=4&template=bug-report.yml&assignees=&template=report-a-bug.yml&title=🪲+&labels=bug,component,atom,image)
[![npm](https://img.shields.io/npm/dt/%40s-ui/react-atom-image?logo=npm&labelColor=black)](https://www.npmjs.com/package/@s-ui/react-atom-image)

[![Issues open](https://img.shields.io/github/issues-search/SUI-Components/sui-components?query=is%3Aopen%20label%3Acomponent%20label%3Aimage&logo=openbugbounty&logoColor=red&label=issues%20open&color=red)](https://github.com/SUI-Components/sui-components/issues?q=is%3Aopen+label%3Acomponent+label%3Aimage)
[![NPM](https://img.shields.io/npm/l/%40s-ui%2Freact-atom-image)](https://github.com/SUI-Components/sui-components/blob/main/components/atom/image/LICENSE.md)

## Installation

```sh
$ npm install @s-ui/react-atom-image --save
```

## Usage

After importing the component `AtomImage` like this

```javascript
import AtomImage from '@s-ui/react-atom-image'
```

### Basic usage

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
/>
```

### With a title

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
  title="Nice Picture"
/>
```

### With skeleton while loading

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
  title="Nice Picture"
  skeleton={ urlImageSkeleton }
/>
```

### With placeholder while loading

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
  title="Nice Picture"
  placeholder={ urlImagePlaceholder }
/>
```

### With spinner while loading

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
  title="Nice picture"
  spinner={ Spinner }
/>
```

### With custom Error if error loading

```javascript
<AtomImage
  src={ urlImage }
  alt="Nice Picture"
  title="Nice picture"
  errorText="Oh no!! This image couldn't be loaded"
  errorIcon={ MyIconErrorLoading }
/>
```

### With picture sources [mdn picture](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture)

Loads 50x50 image when the viewport is under 480px, elsewise it loads a 150x150 image

```js
<AtomImage
  src='https://via.placeholder.com/50'
  alt=''
  title=''
  sources={[
    {srcset: 'https://via.placeholder.com/150', media: '(min-width: 480px)'}
  ]}
```

### With Web Performance attributes

Attributes to optimize image that is a [LCP](https://web.dev/lcp) element,
usually the first image in the viewport

```js

import AtomImage, {DECODING, FETCHPRIORITY, LOADING} from '@s-ui/react-atom-image'

<AtomImage
  src='https://via.placeholder.com/50'
  alt='Optimized image for LCP'
  title='Optimized image for LCP'
  decoding={DECODING.sync}
  fetchpriority={FETCHPRIORITY.high}
  loading={LOADING.eager}
  sources={[
    {srcset: 'https://via.placeholder.com/150', media: '(min-width: 480px)'}
  ]}
```

Attributes to optimize image that is not a [LCP](https://web.dev/lcp) element,
usually the the images out of the viewport

```js

import AtomImage, {DECODING, FETCHPRIORITY, LOADING} from '@s-ui/react-atom-image'

<AtomImage
  src='https://via.placeholder.com/50'
  alt='Optimized image to lazy load and low the priority'
  title='Optimized image to lazy load and low the priority'
  decoding={DECODING.async}
  fetchpriority={FETCHPRIORITY.low}
  loading={LOADING.lazy}
  sources={[
    {srcset: 'https://via.placeholder.com/150', media: '(min-width: 480px)'}
  ]}
```


> **Find full description and more examples in the [demo page](https://sui-components.now.sh/workbench/atom/image/demo).**

---
_Source: https://npm.io/package/@s-ui/react-atom-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
