I want to create a tree view accordion structure using css and javascript only, no libraries.

In this tree view, all elements have to be checkboxes, so when they get checked they display the children and when they get unchecked they hide them. 

Please anyone can help me.

Below is an example image of what i need to reproduce, but with checkboxes, doesn't have to look that way exactly.

![Sample Image](https://i.stack.imgur.com/rWL7H.png)

Thanks.