How do I address eg. buttons?

Associate a unique piece of text with each component whose state you want to save in TinyDB.
Define a dictionary with those pieces of text as keys and the associated component blocks as values.
Use the generic (Any) blocks on the values.

For a sample, see how the keyboard is updated in this sample: