Display text on multiple lines
See original GitHub issueI 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
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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
Documentation added to README here: https://github.com/iqnivek/react-circular-progressbar/commit/04c3d6e311be7c277e612346e3e9c41e68651f98, so closing this out now!