MH Buttons

unlisted

by MH - Matheus Heidemann

Add customizable floating note buttons based on rules.

Updated 2mo ago
View on GitHub

MH Buttons

Summary

MH Buttons is an Obsidian plugin that adds customizable floating buttons to notes. Buttons appear only when a configured template matches the active note, so different folders, metadata patterns, or note types can get different actions.

The plugin depends on MH-API-TEMPORARY for condition evaluation, icon picking, command picking, and shared translations.

Purpose And Features

  • Create reusable buttons with an icon, name, optional label, and action.
  • Open notes, canvases, and bases through button actions.
  • Run Obsidian commands through button actions.
  • Group buttons into templates.
  • Place each template button in top-left, top-right, bottom-left, or bottom-right.
  • Configure stack direction, edge offsets, and spacing.
  • Control visibility by view mode: edit, reading, or both.
  • Control scroll visibility: always visible, only near the top, only near the bottom, or both.
  • Match templates with rule groups using all or any mode.
  • Use English or Brazilian Portuguese interface strings from locales/.

How It Works / How To Use

Open the plugin settings and create one or more buttons. Each button can either open a note-like file or run a command.

Then create a template. A template contains:

  • the buttons that should appear;
  • the corner for each button;
  • the layout settings for stack, offset, and gap;
  • the view mode where the buttons are allowed to appear;
  • the scroll visibility behavior;
  • rules that decide whether the template applies to the active note.

Rules are evaluated by MH-API-TEMPORARY. The current plugin data supports rule objects such as folder-based rules and property/frontmatter-style rules, depending on what the shared condition editor exposes. There is no reserved frontmatter key required by MH Buttons. Instead, configure a template rule to match whichever property you want to use.

Example frontmatter that can be targeted by rules:

---
content_type: movie
status: active
project: media-library
---

Example template ideas:

  • Match folder Config/Database/Movies and show navigation, note info, top, and bottom buttons.
  • Match frontmatter content_type is movie and show media-specific actions.
  • Match frontmatter project is media-library and show a button that opens a base note.

Button configuration options:

  • Name: displayed in settings, tooltip, and label when enabled.
  • Icon: Lucide icon name, with or without the lucide: prefix.
  • Show label: displays the button name beside the icon.
  • Type: Open note or Run command.
  • Note path: file path for open-note actions.
  • Command: Obsidian command ID selected through the command picker.

Template configuration options:

  • Buttons: selected buttons and their corners.
  • View mode: both, edit only, or reading only.
  • Visibility: always, top, bottom, or top and bottom.
  • Visibility threshold: pixel tolerance for top/bottom visibility.
  • Stack direction: vertical or horizontal.
  • Offset X and Offset Y: distance from note view edges.
  • Gap: spacing between buttons.
  • Rules: conditions and match mode used to select the template.

Installation

Install the plugin folder in your vault under:

.obsidian/plugins/mh-buttons/

Required files for Obsidian installation:

  • main.js
  • manifest.json
  • versions.json
  • locales/

data.json is local vault configuration and should not be included as a release file.

Enable MH-API-TEMPORARY before enabling MH Buttons. If that dependency is missing, MH Buttons shows a dependency warning in its settings tab and retries initialization briefly.

Development

Install dependencies:

npm install

Run a development build with watch mode:

npm run dev

Run TypeScript validation:

npm run typecheck

Build the production bundle:

npm run build

The TypeScript entrypoint is src/main.ts. The generated Obsidian bundle is main.js; do not edit main.js manually.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.