Adobe XD provides several categories of APIs:
The UXP runtime, which provides all the capabilities that aren't XD-specific:
- A browser-like HTML and CSS engine which drives actual XD native UI components – it is not a complete browser engine, but lets you build your UI using familiar web APIs and frameworks.
- Network APIs similar to the web standard XHR,
fetch, and WebSocket found in browsers.
storageAPI, offering sandboxed filesystem access.
A simple module-loader
Read below for how to access XD and UXP APIs...
Most XD APIs are accessed by loading a module via
require(), but some are passed directly to your plugin's handler functions.
- selection - Indicates the selected nodes and related context
- This object is passed as an argument to your command handler function (see above)
- scenegraph - APIs available on document nodes
- Typically you use scenegraph objects by simply accessing the arguments passed to your command's handler function
- To create new nodes in the document, load this module explicitly to access the constructor functions:
let Rectangle = require("scenegraph").Rectangle; let node = new Rectangle();
- Typically you use scenegraph objects by simply accessing the arguments passed to your command's handler function (
- commands - Invoke commands to change the document structure and perform other complex operations.
let commands = require("commands");
- interactions - Data model for interactive prototyping features (also accessible from scenegraph nodes).
let interactions = require("interactions");
- application - APIs for exporting content, initiating edits from panel UI, and getting version / locale info.
let application = require("application");
- clipboard - Copy text to the clipboard.
let clipboard = require("clipboard");
Storage APIs – access via
const fs = require("uxp").storage.localFileSystem;