PHPackages                             swiegmann/kirby-menu - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. swiegmann/kirby-menu

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

swiegmann/kirby-menu
====================

This Kirby CMS-Plugin lets you build and render structured menues with a variety of features.

1.0.4(8mo ago)141.5k2[1 PRs](https://github.com/swiegmann/kirby-menu/pulls)MITPHPPHP &gt;=8.1.0 &lt;8.4.0

Since Oct 24Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/swiegmann/kirby-menu)[ Packagist](https://packagist.org/packages/swiegmann/kirby-menu)[ Docs](https://github.com/swiegmann/kirby-menu)[ RSS](/packages/swiegmann-kirby-menu/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Kirby Menu
==========

[](#kirby-menu)

This [Kirby CMS](https://www.getkirby.com)-Plugin lets you build and render structured menues with a variety of features.

Features
--------

[](#features)

- Custom deepness
- Custom HTML-Tags for root- &amp; child-nodes
- Custom CSS-Classes for active- &amp; descendant nodes
- Custom HTML-Attributes/Values for each node
- Custom user-roles for displaying each node
    - Custom default roles for new nodes
- Usable as a standalone field and a block
    - Block is extendable with own tabs
- All types of the "link"-field can be added as nodes
    - Disclaimer: active- &amp; descendant nodes can only be detected for internal Kirby-Pages

### Current translations

[](#current-translations)

- English
- German

[ ![Block preview](./.github/kirby-menu.png)](./.github/kirby-menu.png)Prerequisites
-------------

[](#prerequisites)

- Kirby 4.3+

Installation
------------

[](#installation)

### Download

[](#download)

Download and copy this repository to `/site/plugins/kirby-menu`.

### Git submodule

[](#git-submodule)

```
git submodule add https://github.com/swiegmann/kirby-menu.git site/plugins/kirby-menu

```

### Composer

[](#composer)

```
composer require swiegmann/kirby-menu

```

Usage
-----

[](#usage)

### Field

[](#field)

1. Add the field to a site- or page-blueprint:

    ```
    fields:
      yourfieldname:
        extends: fields/menu
    ```

    *Note: This is a structure-field. You can overwrite some reasonable properties like* `label` *or* `required`. *See [Structure Field Properties](https://getkirby.com/docs/reference/panel/fields/structure#field-properties) on the Kirby Site.*
2. The backend shows a structure-field where you added it. Add an entry. *\[click (+) to add\]*. Every entry is a full menu. Every menu needs a unique internal key, e.g.: "meta", which is later needed to render the menu in your snippet. Add some nodes and save.
3. The generic Kirby-Method to render the menu in your snippet is:

    ```
    echo $site->menu($field, 'yourmenukey');
    ```

    ... where `$field` is of type `Kirby\Content\Field`.

    In my setup I have added the field `menues` to site.yml and created an entry with the internal key `meta`. This is how the part in my header-snippet looks like:

    ```
