The TableOfContents widget provides a table of contents that allows the toggling of layer visibility and sublayers. The style can be completely changed and skinned to match your own map design.