question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display text on multiple lines

See original GitHub issue

I was trying to customise the “textForPercentage” function and pass it a newline (<br/>) tag but html tags get removed. Is there an easy way to keep the percentages displayed (and animated) and just display a text below the percentage? Like in this picture screencap

This is how I tried to call textForPercentage:

textForPercentage={(p) => { return `${p}%<br/>sold` }}

If html is not desired, maybe just support the “\n” newline character and replace it with a <br/> on display? So

textForPercentage={(p) => { return `${p}%\nsold` }}

would also be a valid option

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kevinsqicommented, Jun 21, 2018

That approach seems possible, but I think a pure svg approach is tricky in general. The approach I’ve recommended is wrapping the base CircularProgressbar in another component that overlays regular html content on top of it with absolute positioning. This allows using regular html elements instead of adding custom behavior around newlines or delving into SVG formatting.

You can try it out here: https://codesandbox.io/s/qlr7w0rm29

Let me know if that would address your needs!

0reactions
kevinsqicommented, Jan 6, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the correct way to display multi line text? - html
Yes, you can put them all in separate paragraphs, using the <p></p> tag or you can separate them via a <br> tag at...
Read more >
Display Text In A Cell On Multiple Lines - The Excel Addict
How To Display Text In A Cell On Multiple Lines · Select the cell where you want the label or heading to appear;...
Read more >
Enable a text box to accept multiple lines of text
Right-click the text box for which you want to enable multiple lines of text, and then click Text Box Properties on the shortcut...
Read more >
How to enter multiple lines in one cell in Excel 2021 - Ablebits
Click on the cell where you need to enter multiple lines of text. · Type the first line. · Press Alt + Enter...
Read more >
What command do you use to display text on two lines ... - Quora
One: Inserting dual or multiple lines of text within a Cell/Merged cell. To accomplish writing a sentence like this you have to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found