mProjectsCode / mProjectsCode/obsidian-meta-bind-plugin

Conditional visibility of button

Open
#588 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature request waiting on upstream change
Dominant language
TypeScript
Stars
1k
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Please fill out these Check-boxes
  • I checked for existing similar feature requests
  • I have read the docs and checked that the feature I am requesting is not already implemented
  • My feature request consists of only one feature
Is your Feature Request related to a Problem or Annoyance?

Allow to show/hide buttons dynamically based on conditions. I want to organize a simple workflow, an example for organizing a catalog of books to read.

Button Condition Action
start-reading page has tag #Book/WishList remove tag #Book/WishList and add #Book/Reading
winish-reading page has tag #Book/Reading remove tag #Book/Reading and add #book/Readed
add-to-wish-list page has not tag #Book/WishList or #Book/Reading set tags #Book and #Book/WishList

I have shown an example of button description below.

Describe the Feature you'd like

For exmple

  • visibleConditions it's array of conditions with OR or AND conditions, maybe replace visibleConditions to hade Conditons
  • if evaluate: true - value is JS and should return boolean result, for example check if tag.score > 10
  • if evaluate: false - use type: hasMetadata/hasntMetadata but it looks like the evaluate property is then redundant
label: Start Reading
icon: ""
style: default
class: ""
cssStyle: ""
backgroundImage: ""
tooltip: ""
id: book-start-reading
visibleConditions:
  - type: checkMetadata
    bindTarget: tags
    evaluate: true
    value: "x == '#Book/Wishlist"
actions:
  - type: updateMetadata
    bindTarget: reading_year
    evaluate: false
    value: "2025"
 - type: updateMetadata
    bindTarget: tags
    evaluate: false
    value: Book Book/Reading

label: Finish Reading
icon: ""
style: default
class: ""
cssStyle: ""
backgroundImage: ""
tooltip: ""
id: book-finish-reading
hidden: true
visibleConditions:
  - type: hasMetadata
    bindTarget: tags
    value: Book
actions:
  - type: updateMetadata
    bindTarget: tags
    evaluate: false
    value: Book
  - type: updateMetadata
    bindTarget: finish_date
    evaluate: true
    value: new Date().getFullYear() + '-' +(parseInt(new Date().getMonth())<10?'0':'') +(parseInt(new Date().getMonth())+1) + '-' +((new Date().getDate())<10?'0':'')+new Date().getDate()

Button usage
BUTTON[book-start-reading, book-finish-reading]

This is just a concept, I don't claim to have the final syntax of conditions

Alternatives

No response

Additional Context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing BUTTON[...] syntax and button configuration, then compare them with the proposed visibleConditions and action examples. No file or test is named, and the request leaves the condition syntax open; done would require an agreed design and implementation for conditional button visibility without breaking existing button usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.