# Custom Menus

You can create custom menus in the `Aurora/gui/menus` folder. You can create subfolders as well inside this folder. Menu filenames must use lowercase english alphabet, numbers and underscore.&#x20;

{% hint style="warning" %}
Every filename must be unique since that will be the ID of the menu.
{% endhint %}

## Example configuration

```yaml
# What commands should open the menu?
# Changing this might require a full server restart depending on server version
# (Optional, can be deleted)
register-commands:
  - "mymenu"

# Title of the inventory
title: "&6Example Menu"
# How many rows should the inventory have?
rows: 6

# Should we refresh the menu periodically? (most of the times, you don't need this)
# (Optional, can be deleted)
refresh: false
# How often should the menu be refreshed? (in seconds, minimum 1, has to be an integer)
# (Optional, can be deleted)
refresh-interval: 5

# What are the requirements for opening the menu? can be multiple
# (Optional, can be deleted)
open-requirements:
  - requirement: "[permission] example.permission"
    # What should happen when this requirement isn't met?
    deny-actions:
      - "[message] You do not have permission to open this menu."

# What should we run when the menu opens? 
# (Optional, can be deleted)
open-actions:
  - "[sound] entity.villager.yes"

# What should we run when the menu gets closed?
# (Optional, can be deleted)
close-actions:
  - "[sound] entity.villager.no"

# Default item to fill the GUI with
# (Optional, can be deleted)
filler:
  material: black_stained_glass_pane
  hide-tooltip: true

# These are the items for the gui.
# For more info, see Item config and Requirement pages
items:
  test:
    # Higher priority means if both items are visible on the same slot, this will win
    priority: 1
    # When periodic refresh is enabled only those items will be refreshed
    # that has refresh: true
    refresh: true
    material: diamond
    name: "&6Test Item"
    lore:
      - "&7%server_time_hh:mm:ss%"
    slot: 13
    on-click:
      - "[open-gui] aaa"
    view-requirements:
      - "![permission] example.permission"
  test2:
    priority: 0
    material: emerald
    name: "&6Test Item {arg_test}"
    lore:
      - "&7This is a test item."
    slot: 13
    on-click:
      - "[console] say Hello world {arg_test}!"
      - "[permission] example.permission"
    click-requirements:
      - requirement: "[arg] test == example"
        deny-actions:
          - "[message] test arg is not example! It is {arg_test}"
```

## Opening a menu

You can open a menu/gui either by the defined `register-commands` or via the `/aurora gui open <player> <menu> [...args]`command.

```
/aurora gui open <player> <menu> arg1={some value} test={10}
```

If you are trying to open the menu from another menu, you can use the `[open-gui]` action.

```
[open-gui] menu_id arg1={some value} test={10}
```

## Menu arguments

As you have seen above, you can pass arguments to menus. You can reference these arugments anywhere by using this syntax: `{arg_key}`. So for the above example: `{arg_test}`. You can also use these in requirements to control menu item visibility or click requirements.

## Actions

For the possible click/open/close actions please see [command-dispatcher](https://docs.auroramc.gg/aurora/command-dispatcher "mention").&#x20;

Everywhere you see `on-click` you can also define an `on-left-click` and `on-right-click` as well.

## Requirements

You can view the available view/open/click requirements here: [requirements](https://docs.auroramc.gg/aurora/custom-menus/requirements "mention").&#x20;

Everywhere you see `click-requirements` you can define `left-click-requirements` and `right-click-requirements` as well.
