Search code examples
nicegui

How to set the width of a ui.input


https://nicegui.io/documentation/input

shows the example:

from nicegui import ui

ui.input(label='Text', placeholder='start typing',
         on_change=lambda e: result.set_text('you typed: ' + e.value),
         validation={'Input too long': lambda value: len(value) < 20})
result = ui.label()

ui.run()

And has 4 Inherited from

  • ValueElement
  • DisableableElement
  • Element
  • Visibility

where the documenation is unforunately not "linked/clickabel".

I wonder how the size of the input can be manipulated. I tried in justpy style just setting "size=80" in the constructor but that doesn't work.

How can the size be set properly?


Solution

  • input=ui.input(...)
    input.props("size=80")
    

    works