input.py 1002 B

1234567891011121314151617181920212223242526272829
  1. import justpy as jp
  2. from typing import Callable
  3. from .string_element import StringElement
  4. class Input(StringElement):
  5. def __init__(self,
  6. *,
  7. label: str = None,
  8. placeholder: str = None,
  9. value: str = '',
  10. design: str = '',
  11. on_change: Callable = None):
  12. """Text Input Element
  13. :param label: display name for the text input
  14. :param placeholder: text to show if no value is entered
  15. :param value: the current value of the field
  16. :param design: Quasar props to alter the appearance (see `their reference <https://quasar.dev/vue-components/input>`_)
  17. :param on_change: callback when the input is confirmed via leaving the focus
  18. """
  19. view = jp.QInput(
  20. label=label,
  21. placeholder=placeholder,
  22. value=value,
  23. change=self.handle_change,
  24. )
  25. super().__init__(view, design, value, on_change)