# Creating a new hud

{% tabs %}
{% tab title="New hud" %}
Create new hud by adding new section to the section "*huds*" inside **config.yml**

```yaml
configuration:
  hud-refresh:
    period: 1 #IN SECONDS
  
  huds:
    example-hud: #I've just added the section for the new hud
```

{% hint style="info" %}
You can create unlimited number of huds, but only one hud can be active at one time
{% endhint %}
{% endtab %}

{% tab title="Display" %}
Now choose what display method you want to use. There only 2 options: **ACTIONBAR** and **BOSSBAR**

```yaml
configuration:
  hud-refresh:
    period: 1 #IN SECONDS
  
  huds:
    example-hud:
      display: ACTIONBAR
    
```

{% hint style="info" %}
Actionbar is recommended, because it's responsive to the client's resolution settings
{% endhint %}
{% endtab %}

{% tab title="Permission" %}
If you want, you can set permission condition for this hud. Players without this permission won't see this hud. (This is optional)

```yaml
configuration:
  hud-refresh:
    period: 1 #IN SECONDS
  
  huds:
    example-hud:
      display: ACTIONBAR
      permission: "betterhud.hud.example" #This is an example, you can change the whole text 
```

{% endtab %}

{% tab title="Toggle command" %}
You can also create a new toggle command for the hud. This is optional as well.

```yaml
configuration:
  hud-refresh:
    period: 1 #IN SECONDS
  
  huds:
    example-hud:
      display: ACTIONBAR
      permission: "betterhud.hud.example" #This is an example, you can change the whole text
      toggle-command: "/examplehud" #This will take effect after restarting the server  
```

{% endtab %}

{% tab title="Toggle actions" %}
If you want to display the hud, when certain event is called, you can set **toggle-actions**

#### Available toggle actions:

```yaml
on-gamemode-change-to: "SURVIVAL" #Valid values: SURVIVAL, ADVENTURE, CREATIVE, SPECTATOR
on-join: true
underwater: true
on-damage-by-entity: true
on-damage-by-player: true
```

#### Example (we want to show this hud, only when player is under water):

```yaml
configuration:
  hud-refresh:
    period: 1 #IN SECONDS
  
  huds:
    example-hud:
      display: ACTIONBAR
      permission: "betterhud.hud.example" #This is an example, you can change the whole text
      toggle-command: "/examplehud" #This will take effect after restarting the server 
      toggle-actions:
        underwater: true
```

{% endtab %}

{% tab title="Hud content" %}
{% content-ref url="hud-content" %}
[hud-content](https://apigames.gitbook.io/betterhud/tutorials/hud-content)
{% endcontent-ref %}
{% endtab %}
{% endtabs %}
