Where do you want to change stuff, is this an inline field, a frontmatter field, or just a random field/text like display: flex within a CSS block or similar?
For inline fields and frontmatter fields, I do believe you’ve got options related to the meta-bind plugin and the usage of classes. I’ve not used them myself, but I do believe I’ve seen similar use cases. You could possibly also use the autoprop of the Meta-Edit plugin
If you want to change random text/field within CSS or similar, I’ve not seen any plugins doing that, and I don’t see an easy way of achieving that through a plugin either, unless you make the plugin language aware, and then allow for some specific replace function on words (or words in a context).
In order to reproduce this, create a constant variable for the select and every option. Define these constants as I did except replace the second string (ex. “Option 1”) with your text of choice.
Afterwards, append each child element to the select element
Make sure to remember the following,
You need to add a new const with a new value for each additional element
You need to append each additional constant variable
The reason it doesn’t work for Dataview inline fields is you’d be querying the HTML element, not the value within said element
If you did [heading::<h1>heading</h1>], it would not query heading, it would query <h1>heading</h1> (would still be stylized due to the rendering of html in dataview)
That said, it could be done using some DataviewJS. My schedule is packed but, I’ll make sure to look into it
It definitely can serve a purpose in some use cases. Perhaps it could be tweaked to remember the selection. As it stands, when I reopen Obsidian, the provided snippet returns to Option 1 regardless of which option was chosen previously.
Of course, it would be great if there were also a way to make this usable to set values for metadata. But there are plugins to accomplish this; however, they require a rendered table or dialogs to be interacted with. Perhaps, Buttons could be used, but a simple dropdown to change metadata would be quite elegant. Perhaps this already exists. Or, maybe something like this is soon approaching with Obsidian’s upcoming metadata improvements.
Thanks again for spending the time to share this! Very cool!