Skip to content

User Menu

You can customize your panel's navigation menu by providing a custom user menu in your panel definition

Defining a custom menu example

go
UserMenu(
    panel.NewUserMenu().
        Actions(
            panel.NewMenuAction("preferences").
                Label("Preferences").
                Icon(icons.Cog).
                ShortCut("cmd+L").
                Callback(func(ctx *context.PanelMenuContext) {
                    //
                    panelPath := ctx.GetPanelPath()
                    ctx.Redirect(panelPath + "/user/preferences")
                }),
            panel.NewMenuAction("logout").
                Label("Logout").
                Icon(icons.LogOut).
                TopSeparator().
                ShortCut("CTRL+K").
                Callback(func(ctx *context.PanelMenuContext) {
                    notification.NewNotification("Logging you out!").Send(ctx.Writer)
                    // Log out logic
                }),
        ),
).

Released under the MIT License.