Skip to content

Button syntax for Obsidian

Button syntax in Obsidian refers to the formatting used by plugins—specifically those interacting with features like Media-Extended—to create interactive code blocks. These blocks render as clickable UI elements that can trigger commands or actions within the application^[600-developer-tools-obsidian-obsidian-admonition.md].

Syntax Structure

Buttons are typically defined within a standard Markdown code block. The type of the code block is declared as button immediately following the opening backticks^[600-developer-tools-obsidian-obsidian-admonition.md].

The configuration of the button's behavior and appearance is handled using specific key-value pairs placed inside the code block^[600-developer-tools-obsidian-obsidian-admonition.md].

Parameters

The following parameters are supported within the button code block^[600-developer-tools-obsidian-obsidian-admonition.md]:

  • name: Sets the display text for the button.
  • type: Specifies the category of the action (e.g., command).
  • action: Identifies the specific command to be executed (e.g., Toggle spellcheck).
  • color: Defines the visual color of the button (e.g., red).

Example

Below is an example of the syntax used to create a button that toggles the spellcheck feature^[600-developer-tools-obsidian-obsidian-admonition.md]:

```button  
name Toggle spellcheck  
type comand  
action Toggle spellcheck  
color red  
```

Sources

^[600-developer-tools-obsidian-obsidian-admonition.md]