Expand
Expand provides expandable layout.
API
func Expand(c *tgframe.Container, title string, expanded bool, conf ...*ExpandConf) *tgframe.Container
cis the container to add the expandable component to.titleis the title of the expandable component.expandedis the initial expanded state of the expandable component.confis an optional configuration, at most one.
// ExpandConf is the configuration for the Expand component.
type ExpandConf struct {
tgframe.Base // ID
}
The client keeps whether an expander is open, so it claims an id derived from
its title. Two expanders with the same title collide; give one of them a
Conf.ID.
Example
expand := tgcomp.Expand(p.Main, "Expand", true)
tgcomp.Text(expand, "A expand!")
tgcomp.Expand(c, "Details", false, &tgcomp.ExpandConf{ID: "second_details"})
Rendering
The contents are built on the first open and then stay rendered, hidden while collapsed. An expander that was never opened costs nothing, and collapsing one that was opened keeps what it holds.