> For the complete documentation index, see [llms.txt](https://frinn.gitbook.io/custom-machinery-1.19/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frinn.gitbook.io/custom-machinery-1.19/creating-custom-machines/machine-gui/text-element.md).

# Text element

Add text in the machine gui.

Text element is used to render a text on the Machine GUI.

Text elements are defined in json with : `"type": "custommachinery:text"`.

The text must be a single [text component](/custom-machinery-1.19/misc/text-component.md) and can't have multiple lines (use multiple text elements for that).

You can change the size of text using `width` and `height` property.

{% hint style="info" %}
By default all text gui elements are hidden in jei, to make them show up see the "jei" property below.
{% endhint %}

### Properties

The text element has 4 mandatory properties and 7 optional properties :&#x20;

#### Mandatory properties

```json5
"type": "custommachinery:text" //Mandatory to define a text element.
```

<details>

<summary>X</summary>

#### Name : `x`

#### Description :&#x20;

A positive integer value that define the x axis position of the element to be displayed on the Machine GUI.

#### Example :&#x20;

The element will be rendered 100px to the right from the top-left corner of the gui.

```json5
"x": 100
```

</details>

<details>

<summary>Y</summary>

#### Name : `y`

#### Description :&#x20;

A positive integer value that define the y axis position of the element to be displayed on the Machine GUI.

#### Example :&#x20;

The element will be rendered 100px to the bottom from the top-left corner of the gui.

```json5
"y": 100
```

</details>

<details>

<summary>Text</summary>

#### Name : `text`

#### Description :&#x20;

A [text component](/custom-machinery-1.19/misc/text-component.md) to be rendered on the GUI.

#### Example :&#x20;

A simple line of text :&#x20;

```json
"text": "An Awesome Title For My Machine GUI !"
```

Adding some style options :&#x20;

```json
"text": {"text": "Red and bold text", "color": "red", "bold": true}
```

</details>

#### Optional properties

<details>

<summary>Priority</summary>

#### Name : `priority`

#### Description :&#x20;

An integer property that define the priority of the Element to be rendered.&#x20;

Elements with higher priority will be rendered first. If 2 elements are at the same position the first to be rendered will be under and the last will be above.

#### Default : 0

#### Example :&#x20;

The element will be rendered under each element that have a priority lower than 1000.

```json5
"priority": 1000
```

</details>

<details>

<summary>Alignment</summary>

#### Name : `alignment`

#### Description :&#x20;

How the text is aligned compared to the Element position. Available values are `left/center/right`

#### Default : `left`

The left of the text string will be at the Element position.

#### Example :&#x20;

```json5
"alignment": "center" //The center of the text string will be at the element position.
```

</details>

<details>

<summary>Jei</summary>

#### Name : `jei`

#### Description :&#x20;

A boolean that define if the element should render in jei.

#### Default : `false`

#### Example :&#x20;

The element will render in jei :&#x20;

```json
"jei": true
```

</details>

<details>

<summary>Tooltips</summary>

#### Name : `tooltips`

#### Description :&#x20;

A list of [Text components](/custom-machinery-1.19/misc/text-component.md) that will be shown as tooltips when the player mouse cursor hover the element.

Each tooltips of the list will be a new line.

#### Example :&#x20;

Replace the default tooltips with a single line that say "Click me !" :&#x20;

```json
"tooltips": "Click me !"
```

</details>

<details>

<summary>Width</summary>

#### Name : `width`

#### Description :&#x20;

A positive integer value that define the width of the element on the Machine GUI.

#### Default :&#x20;

The width of the specified text.

#### Example :&#x20;

The width of the element will be 100px.

```json5
"width": 100
```

</details>

<details>

<summary>Height</summary>

#### Name : `height`

#### Description :&#x20;

A positive integer value that define the height of the element on the Machine GUI.

#### Default :&#x20;

The default height of text in Minecraft (about 9px).

#### Example :&#x20;

The height of the element will be 100px.

```json5
"height": 100
```

</details>

<details>

<summary>Tooltips</summary>

#### Name : `tooltips`

#### Description :&#x20;

A list of [Text components](/custom-machinery-1.19/misc/text-component.md) that will be shown as tooltips when the player mouse cursor hover the element.

Each tooltips of the list will be a new line.

#### Example :&#x20;

Replace the default tooltips with a single line that say "Click me !" :&#x20;

```json
"tooltips": "Click me !"
```

</details>

### Example

A basic text element :

```json5
{
    "type": "custommachinery:text",
    "x": 20,
    "y": 20,
    "text": "My Awesome Machine"
}
```

Result :

![A text element](https://github.com/Frinn38/Custom-Machinery/raw/1.16.5/wiki/text_element.png)
