Meta Bind JS Button arguments

What I’m trying to do

Reading this bit of documentation from the Meta Bind plugin:

interface JSButtonAction {
  type: 'js';
  file: string; // the path to the JavaScript file to run, relative to the vault root
  args?: Record<string, unknown>; // optional arguments to pass to the script
}

How do you define the arguments in YAML for this? And how do you reference them in a script?

Things I have tried

YAML lists; children of args key did not work (unless I referenced them incorrectly)

style: primary
label: June 4
id: tomorrow-btn
hidden: true
class: nav
actions:
  - type: js
    file: "Files/dbutton.js"
    args:
      text: "Hello, world"

You can Access the context Object in the js.

console.log({context});
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.