Agile UI
  • Overview of Agile UI
  • Quickstart
  • Core Concepts
  • File structure example & first app
  • Components
  • JavaScript Mapping
  • Advanced Topics
Agile UI
  • Menu
  • View page source

Menu

class Atk4\Ui\Menu

Menu implements horizontal or vertical multi-level menu by using Fomantic-UI ‘menu’.

Using Menu

Atk4\Ui\Menu::addItem($label, $action)

Here is a simple usage:

$menu = Menu::addTo($app);
$menu->addItem('foo');
$menu->addItem('bar');

to make menu vertical:

$menu->addClass('vertical');

Decorating Menu Items

See MenuItem for more options:

$menu->addItem(['foo', 'icon' => 'book']);

Specifying Links and Actions

Menu items can use links and actions:

$menu->addItem('foo', 'test.php');
$menu->addItem('bar', new JsModal('Test'));

Creating sub-menus

Atk4\Ui\Menu::addMenu($label)
Atk4\Ui\Menu::addGroup($label)
Atk4\Ui\Menu::addRightMenu($label)

You can create sub-menu for either vertical or horizontal menu. For a vertical menu you can also use groups. For horizontal menu, you can use addRightMenu.

$menu = Menu::addTo($app);
$menu->addItem('foo');
$sub = $menu->addMenu('Some Bars');
$sub->addItem('bar 1');
$sub->addItem('bar 2');

Headers

Atk4\Ui\Menu::addHeader($label)

Advanced Use

You can add other elements inside menu. Refer to demos/basic/menu.php.

MenuItem

class Atk4\Ui\MenuItem
property Atk4\Ui\MenuItem::$label
property Atk4\Ui\MenuItem::$icon

Additionally you can use View::addClass() to disable or style your menu items.


© Copyright 2016-2025, Agile Toolkit.

Built with Sphinx using a theme provided by Read the Docs.