<n8n-demo>

Workflow preview web component

API

<n8n-demo>

Attributes

NameDescriptionTypeDefault
workflowWorkflow json to load.string'{}'
frameWhether to add frame around canvas with code and copy buttonstring'false'
srcURL for n8n instance to load workflow.string'https://n8n-preview-service.internal.n8n.cloud/workflows/demo'
collapseformobileWhether to collapse on mobile, so that scrolling on mobile is easier.string'true'
clicktointeractAdd button before users can interact with canvas. Makes scrolling through page easier without getting bugged down.string'false'
hidecanvaserrorsHide node errors on the canvasstring'false'
disableinteractivityDisable interactivity entirely. This will prevent the user from interacting with the workflow.string'false'
themeWhether to force a theme on n8n. Accepts 'light' and 'dark''light' | 'dark' | undefined
modeMode for the component. 'demo' for single workflow view, 'diff' for comparing two workflows.'demo' | 'diff''demo'
workflowbeforeThe "before" workflow JSON for diff mode comparison.string'{}'
tidyupWhether to auto-tidy (auto-layout) the workflow when loaded.string'false'

Properties

NameAttributeDescriptionTypeDefault
workflowworkflowWorkflow json to load.string'{}'
frameframeWhether to add frame around canvas with code and copy buttonstring'false'
srcsrcURL for n8n instance to load workflow.string'https://n8n-preview-service.internal.n8n.cloud/workflows/demo'
collapseformobilecollapseformobileWhether to collapse on mobile, so that scrolling on mobile is easier.string'true'
clicktointeractclicktointeractAdd button before users can interact with canvas. Makes scrolling through page easier without getting bugged down.string'false'
hidecanvaserrorshidecanvaserrorsHide node errors on the canvasstring'false'
disableinteractivitydisableinteractivityDisable interactivity entirely. This will prevent the user from interacting with the workflow.string'false'
themethemeWhether to force a theme on n8n. Accepts 'light' and 'dark''light' | 'dark' | undefined
modemodeMode for the component. 'demo' for single workflow view, 'diff' for comparing two workflows.'demo' | 'diff''demo'
workflowbeforeworkflowbeforeThe "before" workflow JSON for diff mode comparison.string'{}'
tidyuptidyupWhether to auto-tidy (auto-layout) the workflow when loaded.string'false'
showCodebooleanfalse
showPreviewbooleantrue
fullscreenbooleanfalse
insideIframebooleanfalse
copyTextstring'Copy'
isMobileViewbooleanfalse
errorbooleanfalse
interactivebooleantrue
scrollXnumber0
scrollYnumber0
n8nReadybooleanfalse
iframeVisiblebooleanfalse
observernew IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { const iframe = this.shadowRoot!.getElementById( 'int_iframe' ) as HTMLIFrameElement; this.observer.unobserve(iframe); this.iframeVisible = true; if (this.n8nReady) { if (this.mode === 'diff') { this.loadDiff(); } else { this.loadWorkflow(); } } } }); })
receiveMessage
onDocumentScroll

Methods

NameParametersDescriptionReturn
loadWorkflow
loadDiff
toggleCode
onMouseEnter
onMouseLeave
onOverlayClick
copyClipboard
toggleView
renderIframe