How to Pre-check Checkboxes Using Interact.jl?

How do I use Interact.jl to present a list of checkboxes with some of the boxes already checked off? Tried following the documentation and couldn’t figure out how to set specific checkboxes to true (i.e. checked off).

What I have currently, is this:

image

The boxes are empty by default. What I would like to have happen is for a few boxes to already be checked off when they are first shown like this:

image

The code I have been using is:

using Interact
options = Observable(["a", "b", "c"])
wdg = checkboxes(options)
wdg

Thanks!

~ tcp :deciduous_tree:

1 Like

Issue opened here as it is still unclear how to achieve this: https://github.com/JuliaGizmos/Interact.jl/issues/386

I figured it out! Thanks to @piever , here is a solution that works:

options = ["a", "b", "c"]
value = ["a", "c"]
checkboxes(options, value = value)

3 Likes