Skip to content

Action Group

Keeps the primary action visible and measures its container so trailing, lower-priority actions move into one flat overflow Dropdown only when needed.

Last action:

Usage Example
@actiongroup.ActionGroup(actiongroup.Config{
    Label:   "Release actions",
    Primary: actiongroup.Action{Label: "Publish", OnClick: "publish()"},
    Secondary: []actiongroup.Action{
        {Label: "Preview", Href: "/preview"},
        {Label: "Schedule", OnClick: "schedule()"},
        {Label: "Archive", Disabled: true, Tooltip: "Published releases cannot be archived"},
    },
})

Stacked actions flatten into overflow

Items renders one ordinary flat Dropdown while space permits. When constrained, its child items become a labeled section in the shared overflow Dropdown; Goshtoso never creates nested menus.

Last action:

Stacked actions flatten into overflow
@actiongroup.ActionGroup(actiongroup.Config{
    Label:   "Chart actions",
    Primary: actiongroup.Action{Label: "Refresh", OnClick: "refreshChart()"},
    Secondary: []actiongroup.Action{
        {
            Label: "Export",
            Items: []actiongroup.Action{
                {Label: "PNG", Icon: imageIcon(), OnClick: "exportPNG()"},
                {Label: "CSV", Icon: tableIcon(), OnClick: "exportCSV()"},
            },
        },
        {Label: "Duplicate", OnClick: "duplicateChart()"},
    },
})

Priority follows source order

Secondary actions are ordered highest to lowest priority. The runtime keeps leading actions inline and moves trailing actions first.

Priority follows source order
// Save remains primary. Edit outranks Share, and Share outranks Delete.
@actiongroup.ActionGroup(actiongroup.Config{
    Primary: actiongroup.Action{Label: "Save"},
    Secondary: []actiongroup.Action{
        {Label: "Edit"},
        {Label: "Share"},
        {Label: "Delete", Danger: true},
    },
})

Go API

v0.0.13

The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.

github.com/araihu/goshtoso/components/actiongroup
Open v0.0.13 API