---
title: "Image"
description: "One picture with an optional caption; zoom opens it full screen."
---

> Documentation Index
> Fetch the complete documentation index at: https://gistui.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Image

```gistui
root = Image("https://images.unsplash.com/photo-1490806843957-31f4c9a91c65?w=900&q=75&auto=format&fit=crop", "Mount Fuji behind cherry blossom", caption:"Mount Fuji in spring", ratio:"16/9", zoom)
```

## Signature

This is the line a model reads in the system prompt.

```gistui
Image(src, alt?, caption:str, ratio:str, zoom)
```

- **Group:** Content
- **Children:** No
- **Positional arguments:** `src`, `alt?` (a trailing `?` means it may be left out)

## Props

| Prop | Type | How to write it | Notes |
|---|---|---|---|
| `src` | string (URL) | positional, required |  |
| `alt` | string | positional, optional |  |
| `caption` | string | named: `caption:…` |  |
| `ratio` | string | named: `ratio:…` | e.g. 16:9, 4:3, 1:1 |
| `zoom` | flag | bare word: `zoom` | click opens a lightbox |

## Use your own component

Keep the name and schema, swap what is drawn. The prompt and the model's output do not change.

### React

```tsx
import { ui } from "@gistui/react/ui";

const lib = ui.extend({ Image: MyImage });
<GistUI library={lib} stream={response.body} />;
```
### Vue

```vue
<GistUI :source="answer" :components="{ Image: MyImage }" />
```
### Svelte

```svelte
<GistUI source={answer} components={{ Image: MyImage }} />
```
### Solid

```tsx
<GistUI source={answer()} components={{ Image: MyImage }} />
```
### Vanilla

```ts
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ Image: (ctx) => ({ el: myElement(ctx) }) });
```

See [Custom components](/docs/guides/custom-components/) for the full contract. Style hook: `[data-gistui="Image"]`.

Source: https://gistui.com/docs/components/content/image/index.mdx
