ui.hiddeninput

HiddenInput

This element is used for hidden input data that should not be visible to the user.

But it will be sent back to the server when the form is submitted.

Example:

:type name: str

:type value: Any

from uiwiz import ui
from pydantic import BaseModel

class HiddenInputExample(BaseModel):
    csrf_token: str
    age: int


@app.ui("/ui/hiddeninput/submit")
async def ui_hiddeninput_submit(data_input: HiddenInputExample):
    with ui.toast().set_auto_close(False).success():
        ui.dict(data_input.dict()).border_classes("")

with ui.form().on_submit(ui_hiddeninput_submit):
    ui.hiddenInput(name="csrf_token", value="hidden_csrf_token")
    ui.input("age", None, "Enter your age")
    ui.button("Submit")

Constructor

name: strNo default required argument
value: Optional= None

Methods

after_render(html: str) -> str
This method is called after the element is rendered.
:param html: The rendered HTML of the element.
before_render() -> Any
This method is called before the element is rendered.
classes(input: str) -> Self
Set tailwind classes for the element.
:param input: The tailwind classes to apply to the element.
:return: The current instance of the element.
get_classes() -> str
Get html classes of the element.
:return: The classes of the element.
:type: str
render(render_script: bool) -> str
Render the element as HTML.
:param render_script: If any element has a javascript script, it will be rendered as well.
:type render_script: bool
size(size: Literal) -> Self
Set the size of the element.
:param size: The size of the element.
:return: The current instance of the element.
GitHub