obsidian-meta-bind-plugin
obsidian-meta-bind-plugin copied to clipboard
Conditional visibility of button
Please fill out these Check-boxes
- [x] I checked for existing similar feature requests
- [x] I have read the docs and checked that the feature I am requesting is not already implemented
- [x] 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
visibleConditionsit'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 iftag.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