QOR Admin provides flexible way to manage menus. By default, Resource will be listed at the top level of menu. You can set the position manually.


Admin.AddResource(&Product{}, &admin.Config{Menu: []string{"Product Management"}})
Admin.AddResource(&Color{}, &admin.Config{Menu: []string{"Product Management"}})
Admin.AddResource(&Size{}, &admin.Config{Menu: []string{"Product Management"}})

Admin.AddResource(&Order{}, &admin.Config{Menu: []string{"Order Management"}})

This will generate menus like this:


If you don't want a resource to be displayed in the menu, pass the Invisible option:

Admin.AddResource(&User{}, &admin.Config{Invisible: true})

Register a menu with custom URL

You can add menu with custom URL, like this

Admin.AddMenu(&admin.Menu{Name: "Dashboard", Link: "/admin"})

// Register nested menu, The "menu" under "Dashboard"
Admin.AddMenu(&admin.Menu{Name: "menu", Link: "/link", Ancestors: []string{"Dashboard"}})

// Register menu with permission, User has "admin" permission could access "Report" page.
Admin.AddMenu(&admin.Menu{Name: "Report", Link: "/admin", Permission: roles.Allow(roles.Read, "admin")})

Please check Roles for more permission control informations.

Configure your own menu icon

QOR Admin uses icons from material icons, and pre-generated attribute name on each menu. So it is very easy to customize your own menu icon.

Assume you are adding icon to Product. First, go to material icons page and pick the icon you wanted then copy the content in the screenshot


Then put it in the css, about how to customize css for QOR Admin go check QOR Admin theme.

[qor-icon-name*="Products"] > a::before {
  content: "\E2BF";

Go to QOR Admin, you should see the icon has been displayed beside the product menu.

results matching ""

    No results matching ""