Search code examples
pythonnicegui

NiceGui: Multiline Button


How can I make a multiline button in nicegui?

enter image description here

Quasar example just uses a <br> tag, but it gets escaped by nicegui.


Solution

  • You can use the style white-space: pre-wrap; as in:

    ui.button(text='Multiline\nButton').style('white-space: pre-wrap;')
    

    (Note: to disable the "force capital letters" add the style: text-transform: none;)