manu p
manu p

Reputation: 985

Wrapping texts inside action button

The below HTML code renders properly on shiny

> HTML(paste0(strwrap('I saw a beautiful moon tonight',width=10), collapse="\n"))
I saw a
beautiful
moon
tonight

But when the same in wrapped inside the action button, it is not

actionButton("df", HTML(paste0(strwrap('I saw a beautiful moon tonight',width=10), collapse="\n")))

enter image description here

Expected output

Even inside the button , the sentence should be split into 4 lines

Upvotes: 1

Views: 265

Answers (1)

Clemsang
Clemsang

Reputation: 5481

Use br html tag instead of \n for breaklines:

actionButton("df", HTML(paste0(strwrap('I saw a beautiful moon tonight',width=10), collapse="</br>")))

Upvotes: 3

Related Questions