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.

Default Rendered example

Last action:

Usage Example
@actiongroup.ActionGroup(actiongroup.Config{
    Label:   "Release actions",
    Primary: actiongroup.Action{Label: "Publish", Href: "/releases/publish"},
    Secondary: []actiongroup.Action{
        {Label: "Preview", Href: "/preview"},
        {Label: "Schedule", HTMX: &dropdown.HTMXConfig{Post: "/releases/schedule", Target: "#release-result", Swap: "innerHTML"}},
        // Optional local enhancement remains available after declarative action setup.
        {Label: "Notify", OnClick: "notify()"},
        {Label: "Archive", Disabled: true, Tooltip: "Published releases cannot be archived"},
    },
})

Built-in text: the development API provides expressions.ActionGroup for application defaults, request preferences, and individual component overrides. Read the expression guide.

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.

Stacked actions flatten into overflow Rendered example

Last action:

Stacked actions flatten into overflow
@actiongroup.ActionGroup(actiongroup.Config{
    Label:   "Chart actions",
    Primary: actiongroup.Action{Label: "Refresh", Href: "/charts/current"},
    Secondary: []actiongroup.Action{
        {
            Label: "Export",
            Items: []actiongroup.Action{
                {Label: "PNG", Icon: imageIcon(), HTMX: &dropdown.HTMXConfig{Get: "/charts/export.png", Target: "#export-result", Swap: "innerHTML"}},
                {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 Rendered example
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.3.3

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.3.3 API