DeviceMock
v0.3.13D device mockups of your app, made by your coding agent from live pages or screenshots.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_devices List device models
Lists the device models: ids, names, types, sizes in mm (facing the camera, open, portrait), width/height ratios, body colors, the screenshot size that fits each screen with almost no crop (for landscape, swap its width and height), and the hinge range of foldables and laptops.
list_presets List presets
Lists canvas size presets and rotation presets with their tilt, turn, and spin. Each canvas preset has a group: general, app-store, or google-play. Store screenshot presets give the portrait size. rotates: true means landscape is also accepted, with width and height swapped. The feature graphic is always 1024 x 500.
new_mockup New mockup
Starts a new, empty mockup with a transparent background. It replaces the current mockup. The canvas is a preset's size, or width x height in px (each defaults to 1600 x 900); width and height override a preset's size. Store screenshot presets start in portrait. landscape: true swaps their width and height. The feature graphic is always 1024 x 500.
| Parameter | Type | Description |
|---|---|---|
height | integer | |
landscape | boolean | Store screenshot presets: true starts the canvas in landscape, with width and height swapped. Omit this parameter for the feature graphic. |
preset | string | Canvas preset id from list_presets, for example hero. |
width | integer |
resize_canvas Resize the canvas
Changes the canvas to a preset's size or to width x height in px. Each device and text layer keeps its relative position on the canvas. Device sizes, text sizes, text widths, and shadows scale by the smaller of the width and height scale factors. A taller or wider canvas gets more empty space. Check the preview after resizing.
| Parameter | Type | Description |
|---|---|---|
height | integer | |
landscape | boolean | Store screenshot presets: true uses landscape, with width and height swapped. Omit this parameter for the feature graphic. |
preset | string | Canvas preset id from list_presets, for example iphone-6.9. |
width | integer |
set_background Set the background
Sets the canvas background: none (transparent), a color, a linear gradient, or an image.
| Parameter | Type | Description |
|---|---|---|
type * | string | |
angle | number | For gradient: the direction in degrees, as in CSS: 0 is bottom to top, 90 left to right, 180 (the default) top to bottom. |
color | string | For color: #rrggbb. |
fit | string | For image: fill (default) or fit. |
from | string | For gradient: the start color, #rrggbb. |
image | string | For image: a PNG, JPEG, or WebP file path, an image URL, or a web page URL to capture at the canvas size. |
placement | object | Where the image sits in its frame after the fit, as the editor's Adjust dialog does. Omitted fields keep their value. A new image starts centered. |
to | string | For gradient: the end color, #rrggbb. |
add_device Add a device
Adds a device in front of the others. By default it is centered, faces the camera, and is 0.7 of the canvas height in portrait (landscape keeps that scale). Returns the new device, with its id.
| Parameter | Type | Description |
|---|---|---|
model * | string | Device model id from list_devices, for example iphone-18-pro. |
color | string | Body color: #rrggbb, or a color name of the model from list_devices. |
coverFit | string | Foldables only: the fit of the cover screen image. |
coverPlacement | object | Foldables only: where the cover screen image sits, as placement does. |
coverScreenshot | string | null | Foldables only: the image for the cover (outer) screen. A PNG, JPEG, or WebP file path, an image URL, or a web page URL to capture at the screen's size. |
fit | string | fill (default): crop the image to fill the screen. fit: show all of it, with black bars. |
fold | number | Foldables and laptops: the hinge angle in degrees. 0 is closed. Foldables open to 180 (the default); laptops have their own default and largest angle in list_devices. A folding book keeps its right ha… |
layer | string | Moves the device in front of or behind all the others. New devices go in front. |
name | string | A name for the device. Tools also find it by name. |
orientation | string | Phones, tablets, and foldables: portrait (default) or landscape. Landscape turns the device a quarter turn counterclockwise (its top to the left) before tilt, turn, and spin, and shows a landscape scr… |
perspective | number | Camera field of view in degrees (default 20). Low values look flatter: for a laptop seen from the front, 5 to 10 keeps the base from looking much wider than the lid. |
placement | object | Where the image sits in its frame after the fit, as the editor's Adjust dialog does. Omitted fields keep their value. A new image starts centered. |
rotation | string | Rotation preset id from list_presets, for example angled-right. tilt, turn, and spin change it. |
screenshot | string | null | The screen image. A PNG, JPEG, or WebP file path, an image URL, or a web page URL to capture at the screen's size. null removes the image (the screen is then black). |
shadow | boolean | Soft shadow under the device (default true). |
size | number | Device height as a part of the canvas height (default 0.7), for the device facing the camera: the open height of a foldable or a flip, and the height of an open laptop seen from the front. In landscap… |
spin | number | Degrees in the image plane. Positive turns counterclockwise. |
statusBar | boolean | Phones and foldables: a web page screenshot leaves room at the top for a status bar with the time, signal, and battery, in the page's top color (default true). In landscape, phones hide the status bar… |
tilt | number | Degrees about the horizontal axis. Positive brings the top edge toward the viewer. |
turn | number | Degrees about the vertical axis. Positive turns the device so its left side shows. 180 shows the back. |
x | number | Center of the device: 0 is the left edge of the canvas, 1 the right edge. |
y | number | Center of the device: 0 is the top edge of the canvas, 1 the bottom edge. |
update_device Update a device
Changes a device. Only the given fields change. Returns the device. get_mockup returns the whole mockup.
| Parameter | Type | Description |
|---|---|---|
id * | string | The device id, or its name if no other device has that name. |
color | string | Body color: #rrggbb, or a color name of the model from list_devices. |
coverFit | string | Foldables only: the fit of the cover screen image. |
coverPlacement | object | Foldables only: where the cover screen image sits, as placement does. |
coverScreenshot | string | null | Foldables only: the image for the cover (outer) screen. A PNG, JPEG, or WebP file path, an image URL, or a web page URL to capture at the screen's size. |
fit | string | fill (default): crop the image to fill the screen. fit: show all of it, with black bars. |
fold | number | Foldables and laptops: the hinge angle in degrees. 0 is closed. Foldables open to 180 (the default); laptops have their own default and largest angle in list_devices. A folding book keeps its right ha… |
layer | string | Moves the device in front of or behind all the others. New devices go in front. |
name | string | A name for the device. Tools also find it by name. |
orientation | string | Phones, tablets, and foldables: portrait (default) or landscape. Landscape turns the device a quarter turn counterclockwise (its top to the left) before tilt, turn, and spin, and shows a landscape scr… |
perspective | number | Camera field of view in degrees (default 20). Low values look flatter: for a laptop seen from the front, 5 to 10 keeps the base from looking much wider than the lid. |
placement | object | Where the image sits in its frame after the fit, as the editor's Adjust dialog does. Omitted fields keep their value. A new image starts centered. |
rotation | string | Rotation preset id from list_presets, for example angled-right. tilt, turn, and spin change it. |
screenshot | string | null | The screen image. A PNG, JPEG, or WebP file path, an image URL, or a web page URL to capture at the screen's size. null removes the image (the screen is then black). |
shadow | boolean | Soft shadow under the device (default true). |
size | number | Device height as a part of the canvas height (default 0.7), for the device facing the camera: the open height of a foldable or a flip, and the height of an open laptop seen from the front. In landscap… |
spin | number | Degrees in the image plane. Positive turns counterclockwise. |
statusBar | boolean | Phones and foldables: a web page screenshot leaves room at the top for a status bar with the time, signal, and battery, in the page's top color (default true). In landscape, phones hide the status bar… |
tilt | number | Degrees about the horizontal axis. Positive brings the top edge toward the viewer. |
turn | number | Degrees about the vertical axis. Positive turns the device so its left side shows. 180 shows the back. |
x | number | Center of the device: 0 is the left edge of the canvas, 1 the right edge. |
y | number | Center of the device: 0 is the top edge of the canvas, 1 the bottom edge. |
remove_device Remove a device
Removes a device from the mockup.
| Parameter | Type | Description |
|---|---|---|
id * | string | The device id, or its name if no other device has that name. |
list_fonts List fonts
Lists the fonts for text layers: their ids, names, weight ranges, and supported scripts. Arabic, Hebrew, Thai, and Devanagari text uses a matching Noto font when the chosen font lacks those letters. Chinese, Japanese, Korean, and emoji are not supported yet. add_text reports them as missing.
add_text Add text
Adds a text layer in front of all other layers, using the headline or subtitle preset or your own style. A headline goes at the top center. A subtitle goes below the topmost headline, smaller and lighter. Returns the text layer with its box and line count. missing lists characters that no font supports. Those characters are not drawn. For a fixed width, overflows reports whether any line is wider than the box. cutWords reports whether a line breaks inside a word wider than the box (use a wider box or a smaller size). offCanvas reports whether the text box extends past an edge of the canvas.
| Parameter | Type | Description |
|---|---|---|
text * | string | The text. \n starts a new line. At most 2,000 characters. |
align | string | How the lines align within the box: left, center (default), or right. |
anchor | string | The point of the text box placed at x and y (default top-center). With top-center, the box stays centered and extends downward as it grows. |
color | string | The text color, #rrggbb. |
direction | string | auto (default) takes the direction from the text. ltr sets left-to-right direction. rtl sets right-to-left direction, for example when a right-to-left line starts with a Latin word. |
font | string | A font id from list_fonts (default inter). |
lang | string | A BCP 47 language tag, for example sr-Latn or th. Controls language-specific letter forms and Thai word breaks. |
layer | string | Moves the text in front of or behind all the other layers. New text goes in front. |
letterSpacing | number | Extra space between characters, as a part of size, from -0.5 to 2 (default 0). Arabic letters stay joined. |
lineHeight | number | The line height as a multiple of size (the headline preset uses 1.1). |
name | string | A name for the layer. Without it, the layer's name follows its text. |
opacity | number | 0 to 1 (default 1). |
preset | string | headline (default): large and bold. subtitle: smaller and lighter, below the topmost headline. |
size | number | The text size as a part of the canvas height, for example 0.075 for a headline. |
weight | number | The font weight: 100 is thin, 900 is black. Use a value within the font's weight range from list_fonts. |
width | number | null | A fixed width as a part of the canvas width. Text wraps to this width. null (default) makes the box as wide as its longest line. |
x | number | The anchor point across the canvas: 0 is the left edge, 1 the right edge (default 0.5). |
y | number | The anchor point down the canvas: 0 is the top edge, 1 the bottom edge. |
update_text Update text
Changes a text layer. Only the given fields change. Returns the text layer with its box, line count, missing characters, overflow, breaks inside words, and whether its box extends past a canvas edge.
| Parameter | Type | Description |
|---|---|---|
id * | string | The text layer's id, or a name that identifies exactly one text layer. |
align | string | How the lines align within the box: left, center (default), or right. |
anchor | string | The point of the text box placed at x and y (default top-center). With top-center, the box stays centered and extends downward as it grows. |
color | string | The text color, #rrggbb. |
direction | string | auto (default) takes the direction from the text. ltr sets left-to-right direction. rtl sets right-to-left direction, for example when a right-to-left line starts with a Latin word. |
font | string | A font id from list_fonts (default inter). |
lang | string | A BCP 47 language tag, for example sr-Latn or th. Controls language-specific letter forms and Thai word breaks. |
layer | string | Moves the text in front of or behind all the other layers. New text goes in front. |
letterSpacing | number | Extra space between characters, as a part of size, from -0.5 to 2 (default 0). Arabic letters stay joined. |
lineHeight | number | The line height as a multiple of size (the headline preset uses 1.1). |
name | string | A name for the layer. Without it, the layer's name follows its text. |
opacity | number | 0 to 1 (default 1). |
preset | string | headline (default): large and bold. subtitle: smaller and lighter, below the topmost headline. |
size | number | The text size as a part of the canvas height, for example 0.075 for a headline. |
text | string | The text. \n starts a new line. At most 2,000 characters. |
weight | number | The font weight: 100 is thin, 900 is black. Use a value within the font's weight range from list_fonts. |
width | number | null | A fixed width as a part of the canvas width. Text wraps to this width. null (default) makes the box as wide as its longest line. |
x | number | The anchor point across the canvas: 0 is the left edge, 1 the right edge (default 0.5). |
y | number | The anchor point down the canvas: 0 is the top edge, 1 the bottom edge. |
remove_layer Remove a layer
Removes a device or a text layer from the mockup. remove_device removes devices only.
| Parameter | Type | Description |
|---|---|---|
id * | string | The layer's id, or a name that identifies exactly one layer. |
get_mockup Get the mockup
Returns the whole mockup: the canvas, the background, each device front to back, and each text layer front to back. Includes each text layer's box, line count, missing characters, overflow, breaks inside words, and whether its box extends past a canvas edge.
preview Preview the mockup
Renders the mockup as a small WebP image, so you can check it. A transparent background shows as transparent.
| Parameter | Type | Description |
|---|---|---|
maxSize | integer | Longest side of the preview in px (default 768). |
export_mockup Export the mockup
Renders the mockup at full quality and writes it to a PNG or WebP file. The format comes from the file extension. Folders that do not exist are made, and an existing file is replaced. An export can have at most 16.7 megapixels. At an App Store or Google Play preset size (see list_presets), exports a PNG at exactly that size without transparency. A transparent background becomes white. Returns store checks as warnings for that size.
| Parameter | Type | Description |
|---|---|---|
path * | string | Output file, ending in .png or .webp. Absolute, ~/..., or relative to the server's working directory. |
scale | number | Output px per canvas px. The default is 2 (sharp on high-density screens), or less when 2 would make more than 16.7 megapixels. |
export_store_sizes Export all store sizes
Writes the mockup at every App Store and Google Play preset size into a folder. The files are: app-store/iphone-6.9.png app-store/iphone-6.3.png app-store/iphone-6.5.png app-store/ipad-13.png google-play/phone.png google-play/tablet.png google-play/feature-graphic.png Fits a copy of the layout to each size using resize_canvas's rules. The current mockup stays unchanged. Exports PNGs without transparency. A transparent background becomes white. Replaces existing files. Returns each file's path, size, and store checks as warnings.
| Parameter | Type | Description |
|---|---|---|
folder * | string | The output folder: absolute, ~/..., or relative to the server's working directory. Creates missing folders. |
landscape | boolean | true exports screenshot sizes in landscape with -landscape in each file name, for example iphone-6.9-landscape.png. The feature graphic stays 1024 x 500 and keeps its file name. |
save_mockup Save the mockup
Saves the mockup in the project, so that `npx devicemock render` can make its images again from new screenshots, for example in CI after each deploy. The file is .devicemock/<name>.json at the project root (the folder with .git), and goes into the repo with the images. It has the scene, the source of each image (file paths, image URLs, and web page URLs with their status bar setting), and the outputs. The outputs are the files that export_mockup wrote since new_mockup or open_mockup, with their scales. Call export_mockup first. Image files and outputs must be in the project. The file has no im…
| Parameter | Type | Description |
|---|---|---|
name | string | A name for the mockup, for example hero. Without it: the name that open_mockup or save_mockup used for this mockup, else the file name of the first export (public/hero.png gives hero). |
replace | boolean | true replaces another saved mockup that has the same name. Without it, the save fails, so another mockup is not lost. |
open_mockup Open a saved mockup
Opens a mockup that save_mockup saved (.devicemock/<name>.json at the project root). It replaces the current mockup. It reads each image again from its source: files are read again, and web pages are captured again. The outputs of the saved mockup stay, so save_mockup writes them back with the files that export_mockup writes after this. Returns the mockup, as get_mockup does, and its outputs.
| Parameter | Type | Description |
|---|---|---|
name * | string | The name of a saved mockup, for example hero. |
list_projects List the projects
Lists projects and their mockups in the user's DeviceMock account by team, with the user's own team first. Each team includes own (true for the user's own team), role, plan (individual, team, or null), and canEdit (whether the user can edit that team's projects). When canEdit is false, the projects are read-only. If teams have the same name, use the team's id with the other tools. Each mockup's editorUrl opens it in the DeviceMock editor. open_from_project opens a mockup here, and save_to_project saves the current mockup to a project.
open_from_project Open a mockup from a project
Opens a mockup from a project in the user's DeviceMock account (see list_projects), including mockups made in the DeviceMock editor. The project can be in the user's own team or any team they joined. This replaces the current mockup and downloads its images. Edit it, export it with export_mockup, and save changes with save_to_project. Returns the mockup in the same format as get_mockup.
| Parameter | Type | Description |
|---|---|---|
mockup * | string | The name or id of the mockup in the project. |
project * | string | The name or id of the project. |
team | string | The name or id of the project's team. Use it when projects in different teams have the same name. If omitted, all teams the user belongs to are searched. |
save_to_project Save the mockup in a project
Saves the mockup and its images to a project in the user's DeviceMock account. The user can open it in the DeviceMock editor at editorUrl. A mockup opened with open_from_project is saved in place unless you give it another name. If no project matches the name, a new project is created in the specified team, or in the user's own team when no team is specified. The team's owner and members can open the project as their plan allows. To keep a mockup's images current with new screenshots, use save_mockup to save it in the repo.
| Parameter | Type | Description |
|---|---|---|
project * | string | The name or id of the project. When no project has this name, a new project with this name is made. |
name | string | The name of the mockup in the project. Without it: the name of the mockup that open_from_project opened, else the name that save_mockup used, else the file name of the first export, else Untitled. |
replace | boolean | true replaces another mockup of the project that has the same name. Without it, the save fails, so another mockup is not lost. |
team | string | The name or id of a team the user belongs to (see list_projects). Searches for the project in this team and creates any new project there. If omitted, all teams the user belongs to are searched, and a… |