Sidechair

text.* constants

Browse the reference

Text alignment, wrapping and formatting options for labels, boxes and table cells: text.align_*, text.wrap_* and text.format_*.

Try it in the editor

text.align_left, text.align_center and text.align_right set horizontal alignment; text.align_top, text.align_center and text.align_bottom set vertical alignment. They go in label.new's textalign, box.new's text_halign and text_valign, and table.cell's text_halign and text_valign. text.align_center works for both directions.

text.wrap_auto wraps text to fit the width of the box or cell; text.wrap_none keeps it on one line and clips it. text.format_bold, text.format_italic and text.format_none go in the text_formatting argument. To get bold and italic together, add them: text.format_bold + text.format_italic.

Constants

NameValueDescription
text.align_bottomAlign to the bottom edge.
text.align_centerCentre, horizontally or vertically.
text.align_leftAlign to the left edge.
text.align_rightAlign to the right edge.
text.align_topAlign to the top edge.
text.format_boldBold text.
text.format_italicItalic text.
text.format_noneNo formatting; the default.
text.wrap_autoWrap text to fit the available width.
text.wrap_noneKeep the text on one line.

Remarks

  • text.format_none turns formatting off; it is the default.
  • On Sidechair: label.new reads textalign.

Example

Pine ScriptAligned labelOpen in editor
//@version=6
indicator("Text options", overlay = true)
if barstate.islast
    label.new(bar_index, high, "last\nbar", textalign = text.align_right, style = label.style_label_left, color = color.navy, textcolor = color.white)
plot(close, "Close", color.gray)

See also

Runs on Sidechair