Create custom menu buttons for the Remote Control web interface.
- Copy
custom_menu.example.jsonfrom the module directory to your MagicMirrorconfig/directory - Rename it (e.g.,
custom_menu.json) - Add the filename to your config:
config: {
customMenu: "custom_menu.json",
},{
"id": "custom",
"type": "menu",
"icon": "id-card-o",
"text": "%%TRANSLATE:CUSTOM_MENU%%",
"items": [
{
"id": "custom-item-1",
"type": "item",
"icon": "dot-circle-o",
"text": "Menu Item 1",
"action": "NOTIFICATION",
"content": {
"notification": "NOTIFICATION_TEXT_1",
"payload": "This notification requires a string payload"
}
}
]
}| Property | Description |
|---|---|
id |
Unique identifier. For type: "menu", determines the submenu container. |
type |
"menu", "item", "button", "slider", or "input" |
icon |
FontAwesome icon name (without fa- prefix) |
text |
Display text. Use %%TRANSLATE:KEY%% for translations. |
items |
Array of child items (for type: "menu") |
action |
Action to execute (see below) |
content |
Action parameters |
A submenu containing other items:
{
"id": "my-menu",
"type": "menu",
"icon": "cog",
"text": "Settings",
"items": [...]
}A clickable button that triggers an action:
{
"id": "refresh-btn",
"type": "item",
"icon": "refresh",
"text": "Refresh Mirror",
"action": "REFRESH"
}A slider input (since v2.3.0):
{
"id": "brightness-slider",
"type": "slider",
"icon": "sun-o",
"text": "Brightness",
"action": "BRIGHTNESS",
"content": {
"min": 10,
"max": 200,
"step": 10
}
}A text input field (since v2.3.0):
{
"id": "alert-input",
"type": "input",
"icon": "comment",
"text": "Enter message...",
"action": "NOTIFICATION",
"content": {
"notification": "SHOW_ALERT"
}
}Use Remote Control actions directly:
{
"action": "MONITOROFF"
}{
"action": "BRIGHTNESS",
"content": { "value": 50 }
}Send notifications to any module:
{
"action": "NOTIFICATION",
"content": {
"notification": "SHOW_ALERT",
"payload": {
"message": "Hello World!",
"timer": 3000
}
}
}Use %%TRANSLATE:KEY%% in your text and add the translation to the files in the translations/ directory:
{
"text": "%%TRANSLATE:MY_BUTTON%%"
}In translations/en.json:
{
"MY_BUTTON": "My Button"
}[
{
"id": "scenes",
"type": "menu",
"icon": "image",
"text": "Scenes",
"items": [
{
"id": "scene-day",
"type": "item",
"icon": "sun-o",
"text": "Day Mode",
"action": "NOTIFICATION",
"content": {
"notification": "REMOTE_ACTION",
"payload": { "action": "BRIGHTNESS", "value": 100 }
}
},
{
"id": "scene-night",
"type": "item",
"icon": "moon-o",
"text": "Night Mode",
"action": "NOTIFICATION",
"content": {
"notification": "REMOTE_ACTION",
"payload": { "action": "BRIGHTNESS", "value": 30 }
}
}
]
}
]