Repository navigation
Menu
Viames Marino edited this page Oct 19, 2026
·
3 revisions
Pair\Html\Menu builds navigation menus with active item detection, dropdown groups, and Font Awesome integration.
item(string $url, string $title, ?string $icon = null, ?string $badge = null, ?string $badgeType = null, ?string $target = null): voidgroup(string $title, array $items, ?string $icon = null): voidfontAwesomeStyle(string $style): voidfontAwesomeSize(string $size): voidrender(): stringtitle(string $title): voidseparator(?string $title = null): void
$menu = new \Pair\Html\Menu();
$menu->fontAwesomeStyle('fa-solid');
$menu->fontAwesomeSize('fa-sm');
$menu->item('dashboard', 'Dashboard', 'fa-house');
$menu->group('Settings', [
['users', 'Users', 'fa-user'],
['roles', 'Roles', 'fa-shield'],
]);
echo $menu->render();- Active menu item is resolved from
Application::menuUrlor current router module/action. - Group items support both tuple and associative array item definitions.
- Builders return
void; callitem()andgroup()separately instead of chaining them. - Active detection uses an exact string match. Match the application's
menuUrlor routermodule/actionformat when choosing item URLs. -
render()returns entries, not an enclosing<ul>. The layout owns the list wrapper and the matching CSS/JavaScript. - Rendering consults the current user's ACL. A group with no permitted children produces no dropdown; keep permission checks in the controller as well.
See also: BootstrapMenu, Breadcrumb, Application.
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4