> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# text constants

> Reference for the 8 constants of the text namespace: text.align_bottom, text.align_center, text.align_left, text.align_right and 4 more, each with its definition and an example.

> [!NOTE]
>
> Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: text · Entries: 9

## `text` (library)

**Definition**

Named constants for text alignment (`text.align_*`) and formatting (`text.format_*`) used by label, box, and table.

On boxes and tables, pass alignment to `texthalign` and `textvalign` (not the older `text_halign` / `text_valign` names).

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text Example", overlay=true)
if barstate.islast {
    box.new(bar_index - 10, high, bar_index, low, border_color=color.blue, bgcolor=color.new(color.blue, 0.2), text="Hi", textcolor=color.white, texthalign=text.align_center, textvalign=text.align_bottom, text_formatting=text.format_bold)
    label.new(bar_index, high, "BUY", text_formatting=text.format_italic)
}
```

## `text.align_bottom` (constant)

**Definition**

Vertical text alignment constant that aligns text to the bottom of the container.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.align_bottom Example", overlay=true)
if barstate.islast {
    t = table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(t, 0, 0, text="Close", width=10, height=5, textvalign=text.align_bottom, textcolor=color.white)
}
```

## `text.align_center` (constant)

**Definition**

Text alignment constant that centers text horizontally or vertically in the container.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.align_center Example", overlay=true)
if barstate.islast {
    t = table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(t, 0, 0, text="Close", width=10, height=5, texthalign=text.align_center, textcolor=color.white)
}
```

## `text.align_left` (constant)

**Definition**

Horizontal text alignment constant that aligns text to the left of the container.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.align_left Example", overlay=true)
if barstate.islast {
    t = table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(t, 0, 0, text="Close", width=10, height=5, texthalign=text.align_left, textcolor=color.white)
}
```

## `text.align_right` (constant)

**Definition**

Horizontal text alignment constant that aligns text to the right of the container.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.align_right Example", overlay=true)
if barstate.islast {
    t = table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(t, 0, 0, text="Close", width=10, height=5, texthalign=text.align_right, textcolor=color.white)
}
```

## `text.align_top` (constant)

**Definition**

Vertical text alignment constant that aligns text to the top of the container.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.align_top Example", overlay=true)
if barstate.islast {
    t = table.new(position.top_right, 1, 1, bgcolor=color.gray)
    table.cell(t, 0, 0, text="Close", width=10, height=5, textvalign=text.align_top, textcolor=color.white)
}
```

## `text.format_bold` (constant)

**Definition**

Text formatting constant that renders text in bold.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.format_bold Example", overlay=true)
if barstate.islast {
    label.new(bar_index, high, text="Close: " + str.tostring(math.round(close, 2)), text_formatting=text.format_bold)
}
```

## `text.format_italic` (constant)

**Definition**

Text formatting constant that renders text in italic.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.format_italic Example", overlay=true)
if barstate.islast {
    label.new(bar_index, high, text="Close: " + str.tostring(math.round(close, 2)), text_formatting=text.format_italic)
}
```

## `text.format_none` (constant)

**Definition**

Text formatting constant that applies no special formatting.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("text.format_none Example", overlay=true)
if barstate.islast {
    label.new(bar_index, high, text="Close: " + str.tostring(math.round(close, 2)), text_formatting=text.format_none)
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.