Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion content/widgets/Image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,39 @@ You can manage your assets using Ensemble Studio. [See how](/assets)
| Property | Type | Description |
| :------- | :----- | :---------- |
| source | string | URL to or asset name of the image or an inline SVG string. If the URL is used, it is highly recommended that the dimensions is set (either with width/height or other means) to prevent the UI jerkiness while loading. |
| headers | object | An object containing custom HTTP headers to include when fetching the image from a URL. Only applies to network images (URLs). |
| onTap | action | Call Ensemble's built-in functions or execute code |
| onTapHaptic | enum | The type of haptic to perform when image is pressed. It should be one of heavyImpact, mediumImpact, lightImpact, selectionClick, and vibrate |
| styles | object | [See properties](#styles) |

### styles
## Usage
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage??


A simple example showing how to render a network image without custom headers:

```yaml
Image:
source: https://example.com/avatar.png
styles:
width: 200
height: 200
fit: cover
```

A second example showing how to include custom headers for network image requests:

```yaml
Image:
source: https://example.com/avatar.png
headers:
Authorization: Bearer ${ authToken }
Accept: image/png
styles:
width: 200
height: 200
fit: cover
```

## styles

| Property | Type | Description |
| :------- | :----- | :---------- |
Expand Down