How do I create a list of items to be selected

Hi all. Have asked this before but had no answers as yet.

Please could someone point me in the right direction as to how to create a variable size list of items to choose from. The total list is variable in size up to 100 items, the chosen subset could be any number from none to the whole input list. The option for each item is selected/not selected.

When the initial list is offered, it may already have one or more items selected. It needs to be scrollable as the whole list can be quite large. I use mqtt as the Home remote interface to a node red system and would send the whole list with and expect to get back changes in the selection.

At the moment I haven’t any real clue as to how to start this. I have done simpler processes using radio buttons but this is a good bit more complex.

Any hints or pointers welcome.

Thanks

Take a look at this example I shared a little while back.

Thanks. Wading through that has explained a few things but it still is only 1 selection from a list. I need a variable size list from which I need to select several items.

I have a number of ways of doing this but they all come to a sudden stop at the selection display/choose step because I cannot work out how to do this.

An example: Timer controlling lights. I need to be able to pick from a list of all lights known to the system and link them to this timer. I have a list of all devices in the system (now well over 100) out of which maybe 30 are lights. I need to display that list of 30 and allow the user to select 0-30 of them.

Without hardcoding a group containing every possible device and some way of making them visible and then selectable on a device by device basis I am completely stuck. This obviously is not scalable sensibly.
Any suggestions appreciated.
Thanks