---
title: "Mockup Previews Ajax | Customer&#x27;s Canvas"
canonical: "https://customerscanvas.com/docs/on-premises/ui-framework/widgets/mockup-previews-ajax/"
archived: false
applies_to:
  - product: "Customer's Canvas On-Premises"
    entity_id: "https://customerscanvas.com/glossary/customers-canvas-on-premises#software-application"
  - product: "Customer's Canvas Hub"
    versions: ["cloud"]
    entity_id: "https://customerscanvas.com/products/hub#software-application"
  - product: "UI Framework"
    versions: ["4.0 - 4.47"]
    entity_id: "https://customerscanvas.com/glossary/ui-framework#software-application"
---

# Mockup Previews Ajax

**Applies to:** Customer's Canvas On-Premises; Customer's Canvas Hub cloud; UI Framework 4.0 - 4.47

> Generates mockup previews for a PIM product and exposes image URLs to other widgets.

This non-visual widget generates previews from the mockups of a PIM product. The resulting image URLs are available through the `urls` property and can be displayed with any widget that shows images, for example, [`slider`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/slider.md). Use this widget with [`pim-ajax`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/pim-ajax.md) instead of writing custom `ajax`-based configurations. For product previews, it is a more flexible alternative to [`preview-mockup-slider`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/preview-mockup-slider.md).

```json
{
    "name": "mockup-previews",
    "type": "mockup-previews-ajax",
    "params": {...}
}
```

## Params

- `size`: the preview size, an object with `width` and `height`.
- `state`: the state information, an object with `id` (a private state ID) and the optional `surfacesCount`. If you pass `surfacesCount`, the widget does not request design information.
- `mockups`: mockup descriptions from [`pim-ajax`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/pim-ajax.md).

## Properties

- `urls`: an array of preview image URLs.

## Examples

The following example generates previews for the state returned by Data-Driven Editor and the mockups returned by `pim-ajax`. Here, `state.id` is the state ID returned by Data-Driven Editor.

```json
{
    "name": "mockup-previews",
    "type": "mockup-previews-ajax",
    "params": {
        "autoCompile": false,
        "size": {
            "width": 1200,
            "height": 1200
        },
        "state": {
            "id": "{{ $['dd-editor'].stateId }}"
        },
        "mockups": "{{ $['pim-ajax'].mockups }}"
    }
}
```

To display the previews, pass the `urls` property to any widget that shows images. The following example uses the [`slider`](https://customerscanvas.com/docs/on-premises/ui-framework/widgets/slider.md) widget:

```json
{
    "name": "preview",
    "type": "slider",
    "params": {
        "direction": "tile",
        "rows": 1,
        "columns": "{{ Math.min(2, $['mockup-previews'].urls.length) }}",
        "containerColor": "#eee",
        "images": {
            "{{#each $['mockup-previews'].urls as imageUrl }}": {
                "url": "{{ imageUrl }}"
            }
        }
    }
}
```
