I have 4-5 different layers that are themed in one map. It would be nice to be able to check the layer box and it would display & expand that layer and turn off the display and collapse the other layers without writing a custom API.
That sounds like a mode you might want to put the legend into. Possibly a default setting of the legend when defined in the map but users have the ability to change it if they don't like the behaviour. Alternatively it could be a viewer setting that the user can set as they like. Would this apply to all layers regardless if they are base layers (tiled) or just the dynamic layers?