Clickable checkboxes in card view bases

Hello,

Like several others, I would have liked to be able to click on the checkboxes in the card views of the bases. Unfortunately, this is not possible and it is not planned to be implemented.

So, I thought of an alternative so as not to have to enter the note or navigate through the preview to modify a checkbox property.

Among my bases, I have one that groups my cooking recipe notes, and a menu property that indicates if it is planned for the week. I wanted to be able to quickly add a recipe to my weekly menu by clicking on the property in the card.

Since I regularly use Quickadd, I used these features. (I first tested with Advanced-uri but you cannot modify a boolean frontmatter property).

So, I created a Quickadd macro that takes a filename value entered as a parameter and toggles the desired property in the frontmatter between true and false.

I then used the new feature allowing a URI link to be rendered in a formula in a base with link, to create a URI towards my Quickadd macro, with the note name as a parameter, displaying it as an icon depending on whether the menu is true or false.

To create it, you first need to create a Quickadd macro with a script like this, here I hardcoded the path to my recipe notes, but it is also possible to include it in the URI parameter along with the note name:

module.exports = async (params) => {
    const { quickAddApi, app } = params;
    const filename = params.variables["file"];
    let file = await app.vault.getFileByPath("4 Ressources/Cooking/" + filename + ".md");
    let menu;
    if (file) {
        await app.fileManager.processFrontMatter(file, (frontmatter) => {
            menu = frontmatter["menu"];
            frontmatter["menu"] = !menu;
        });
    }
}

Next, you create a formula in your base like this one. Here I named my macro inmenu, and I display a check icon if the recipe is in the menu, otherwise circle:

link("obsidian://quickadd?choice=inmenu&value-file=" + file.name.replace(" ", "%20"), if(menu, icon("check"), icon("circle")))

So, this gives something like this:

exemple_bases_checkboxes

I am sure it is also possible to adapt this method for properties other than checkboxes, using quickadd inputs.