Create multiple choice picker in preview mode

I think it would be cool if there we UI components that could be in the preview mode that could then set an input to the note. For example, I have a daily template that has the following hidden Dataview inline fields:

%%
Day: Monday
Mood:: 😭,πŸ™,😐,πŸ™‚,πŸ˜€
Focus:: πŸ”΄,🟑,🟒
%%

From the preview mode it would be great to then have a dropdown, hyperlink, or UI that allows me to select one of the values which is then set in the note.

4 Likes

While it wouldn’t be in the preview mode exactly, the Templater Plugin has a System module with a prompt and suggested function that can do just what you’re after.

Mood today: <% tp.system.suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]) %>

The first array is the available options that are displayed. The 2nd array is the actual values for what is displayed; this means that if you select Happy, then Happy should be written out.

3 Likes

Because I intend to do this as part of my evening shutdown routine as a reflection process on my daily note that I’m using throughout the day I can’t really use the templater prompts for this. Another idea I just had though is if I can give a value and on preview have it converted to the icons I want.

For example, if I could enter values like this in my report out

%%
Water:: 2
Food:: 3
Caffeine:: 1
%%

But it converted to icons like this in my table report out

| Metric        | Value        |
| ------------- | ------------ |
|  Water        | πŸ’§πŸ’§         |
|  Food         | πŸ•πŸ•πŸ•       |
|  Caffeine     | β˜•οΈ            |

Note I’m using inline dataview vars like this `=this.Water`

1 Like

I don’t use it myself, but this sounds exactly like what the MetaEdit plugin does.

Maybe check that out? It does a lot of other things too, but easy manipulation of YAML is part of it for sure.

1 Like