# Add newline character to a label

**URL:** <https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 24, 2024, 12:50am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642 "2024-07-24T00:50:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [July 24, 2024, 12:50am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/1 "2024-07-24T00:50:50Z")

</div>

I have a label that is driven by database result.  
This is the text from database:

`Set Side A pressure to 1000 psi, wait until pressure is Stable.\nWhat is the pressure in Side B`

I want to pass this to a single label, should look something like:

```python
Set Side A pressure to 1000 psi, wait until pressure is Stable.
What is the pressure in Side B?

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2024, 1:04am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/2 "2024-07-24T01:04:24Z")

</div>

~~Labels cannot show line breaks. You will need a text area or markdown component.~~

I stand corrected. Just need the right style.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 24, 2024, 3:58am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/3 "2024-07-24T03:58:43Z")

</div>

Sure they can, just set the ~~wrap~~ `white-space` css prop to pre or pre-wrap

Actually you might need to replace the /n with an actual line break char first (ascii 10 or 13?)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 24, 2024, 9:46am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/4 "2024-07-24T09:46:04Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/7/071262625f3fd23b1d835019f891ec9aaf07b7b6.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 24, 2024, 2:55pm UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/5 "2024-07-24T14:55:21Z")

</div>

I remembered doing something like this some time ago with a button. Haven't tested it on a label:

> [@Multiline button in perspective](https://forum.inductiveautomation.com/t/multiline-button-in-perspective/65632/3):
>
> Like @nminchin said: add the whitespace: pre style property: [image] Then add the following expression binding to the text prop: 'Load data\n(from XML)' [image] This is the result: [image]

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 24, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/6 "2024-07-24T14:57:14Z")

</div>

It does work, on pretty much anything.  
I use it on labels, tooltips, buttons...

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 24, 2024, 3:24pm UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/7 "2024-07-24T15:24:10Z")

</div>

![Phil is wrong but right](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/0/00ac27abee219d152629dc7ad3e993905dcb1807.png)

Gee, Phil, it looks like even when you're wrong you're right. What a guy!

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 24, 2024, 9:58pm UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/8 "2024-07-24T21:58:15Z")

</div>

It's OK, Phil's right 99.9999999999999999999999999999999999% of the time so I'm happy to let him be right when he's not as well 😁

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2024, 10:26pm UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/9 "2024-07-24T22:26:15Z")

</div>

It's not noticeably affecting the stats... And still won't when @Eugene49 notices and repoints the solution mark. 😆

---

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [July 30, 2024, 12:44am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/10 "2024-07-30T00:44:50Z")

</div>

Component Text Area -\> Stored in database -\> Displayed in Markdown.  
How do I store the value of text area in database such that it will preserve the newline?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4d52eed5acbb8b4fd0467a34c721df89888b9265.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 30, 2024, 6:37am UTC](https://forum.inductiveautomation.com/t/add-newline-character-to-a-label/93642/11 "2024-07-30T06:37:54Z")

</div>

The string in the text area should have `\n` characters for new lines (even if you don't see them). Just keep them in there.

Then add `whiteSpace: pre` in your markdown component styles.
