# <img>

Shows a picture from a URL or the app's files, sized and cropped by its style.

Category: Media. Also written `<image>`.

```ham
<column style="gap-12 w-full">
    <img src="https://hypeapps.dev/gallery/assets/landscape.jpg"
         style="w-full h-200 rounded-xl"
         fit="cover"/>
    <text style="muted text-sm">Dusk over the hills</text>
</column>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/img-light.webp), [dark](https://hypeapps.dev/img/tags/img-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `alt` | Accessibility label |  |
| `fit` | Image fit mode (BoxFit) (cover, contain, fill, fitWidth, fitHeight, none) | `cover` |
| `height` | Fixed height in pixels |  |
| `loading` | Loading placeholder: fade, spinner, text:..., image:..., none | `fade` |
| `src` | Image source: https://, a base-relative /path, file:/ (bundle), blob:, or a media: reference (a photo kept by <file-picker> / <camera>; a kept file that is gone shows the broken box, never a fetch). $variables interpolate. |  |
| `width` | Fixed width in pixels |  |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Guides and recipes that use it

- [Navigation](https://hypeapps.dev/docs/guides/navigation.md)
- [Your own tags](https://hypeapps.dev/docs/guides/own-tags.md)

## Related tags

- [`<column>`](https://hypeapps.dev/docs/reference/column.md): Stacks its children top to bottom, with a gap between them and an alignment across.
- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<audio>`](https://hypeapps.dev/docs/reference/audio.md): A compact audio player bar with play, a progress track and the track's title and artist.
- [`<camera>`](https://hypeapps.dev/docs/reference/camera.md): A live camera viewfinder with a shutter; the photo's path goes into a variable.
- [`<canvas>`](https://hypeapps.dev/docs/reference/canvas.md): A drawing surface for finger or stylus, with a pen, eraser and color toolbar; it saves as a PNG.
- [`<file-picker>`](https://hypeapps.dev/docs/reference/file-picker.md): Opens the device's photo, video or file picker (or the camera) and puts the chosen file in a variable.
- [`<layer>`](https://hypeapps.dev/docs/reference/layer.md): Declares one layer of a drawing surface: a locked picture to trace over, and a layer to paint on.
- [`<lottie>`](https://hypeapps.dev/docs/reference/lottie.md): Plays a Lottie vector animation from a JSON file; taps and media commands control it.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
