0%

Collapser

A collapser is a widget that can be collapsed or expanded by a user (core.Collapser). It contains a summary part which is always visible, and a details part which is only visible when the collapser is expanded. Collapsers are similar to HTML’s <details> and <summary> tags.

You can make a collapser:

cl := core.NewCollapser(b)
core.NewText(cl.Summary).SetText("Show details")
core.NewText(cl.Details).SetText("Long details about something")

You can put any widgets in a collapser:

cl := core.NewCollapser(b)
core.NewText(cl.Summary).SetType(core.TextHeadlineSmall).SetText("Widgets")
core.NewButton(cl.Details).SetText("Click me!")
core.NewSlider(cl.Details)
core.NewTextField(cl.Details)

Note that anything you enter into the input widgets above persists when you open and close the collapser; that is because collapsers don’t delete the details, they just hide them.