Meta Bind plugin help: Is it possible to edit only one list item while keeping the others as they are?

What I’m trying to do

I’m using this inline select field to change the background styling for the note:

INPUT[inlineSelect(option(Monday), option(Tuesday), option(Wednesday), option(Thursday), option(Friday), option(Saturday), option(Sunday)):cssclasses]

The issue is that pre-existing values for the cssclasses property get erased. I couldn’t find documentation on how to edit only one list item with Meta Bind and preserve the rest as they are.

Things I have tried

I tried using an inlineListSuggester with all of the other necessary cssclasses defined as options. I was hoping that one of the list items could be a menu, but I couldn’t make it work and it’s probably not the right way to approach this.

1 Like

You can access each item in the frontmatter’s list by its index. This is not documented, but seems to be inherited by Meta Bind from the JS syntax:

---
cssclasses:
  - Monday
  - any-other-class
---

`INPUT[inlineSelect(option(Monday),option(Tuesday),option(Wednesday),option(Thursday),option(Friday),option(Saturday),option(Sunday)):cssclasses[0]]`

Just make sure that day always on the first place (cssclasses[0] means - the first element of cssclasses)

1 Like

Thanks, this works like a charm!

1 Like