Creating a Menu

To create a menu for your project, use the set_menu function of the AdminApp object:

app.set_menu([ ... a list of menu items ...])

the set_menu method takes an array of MenuItem objects:

class adminui.MenuItem(name, url='', icon=None, auth_needed=None, children=[])

Represents a menu item

Parameters:
  • name (str) – the title of the menu
  • url (str, optional) – the url the menu will navigate to. Defaults to ‘’.
  • icon (str, optional) – the icon of the menu. See https://ant.design/components/icon/. Defaults to None.
  • auth_needed (str, optional) – the permission needed for user to access this page. e.g. ‘user’ or ‘admin’
  • children (list, optional) – set this if the menu has a sub-menu. Defaults to [].

You may nest MenuItem to create sub-menus. Here’s a complete example:

app.set_menu(
    [
        MenuItem('Home', '/', icon="dashboard", children=[
            MenuItem('New Item', '/new', icon="plus"),
            MenuItem('Search for Item', '/search', icon="search"),
            MenuItem('Admin', '/admin', icon="setting")
        ]),
        MenuItem('About', '/about', icon="info-circle")
    ]
)

It looks like this:

_images/menu_screenshot.png