Component | Password Input
Render a password input box.
- TypeScript / JavaScript
- Python
ui.passwordInput("password-input-key", {
label: "Enter your password",
onEnter: (value) => console.log(value)
})
ui.password_input(
"password-input-key",
label="Enter your password",
on_enter=lambda value: print(value)
)
This component is a light wrapper on top of ui.textInput
with the input obscured.
This component is a light wrapper on top of ui.text_input
with the input obscured.
Learn more about working with inputs.
API reference
Function signature
- TypeScript / JavaScript
- Python
ui.passwordInput(
id: string,
properties?: Partial<{
label: string,
description: string,
required: boolean,
initialValue: string | null,
validate: (value: string | null) => string | void,
onEnter: (value: string | null) => void,
style: Style
}>
)
ui.password_input(
id: str,
*,
label: str | None = None,
description: str | None = None,
required: bool = True,
initial_value: str | None = None,
validate: Callable[[str | None], str | None] | None = None,
on_enter: Callable[[str | None], None] | None = None,
style: Style | None = None
)
Parameters
id
required stringid
required strproperties.label
optional stringThe label to display above the password input. If not provided, the label will be inferred from the id
.
label
optional strThe label to display above the password input. If not provided, the label will be inferred from the id
.
properties.description
optional stringA description to display between the label and password input box.
description
optional strA description to display between the label and password input box.
properties.required
optional booleanValidate that the password input is not empty before submitting the form it's part of or calling it's onEnter
hook. Defaults to true
.
required
optional boolValidate that the password input is not empty before submitting the form it's part of or calling it's on_enter
hook. Defaults to True
.
properties.initialValue
optional string | nullThe initial value of the password input. Defaults to null
. You can also update the value of the password input at any time using the page.setInputs()
method.
initial_value
optional str | NoneThe initial value of the password input. Defaults to None
. You can also update the value of the password input at any time using the page.set_inputs()
method.
properties.validate
optional (value: string | null) => string | voidvalidate
optional Callable[[str | None], str | None]properties.onEnter
optional (value: string | null) => voidon_enter
optional Callable[[str | None], None]properties.style
optional StyleDirectly style the underlying element using CSS. See the styling guide for more details on available style properties.
style
optional Style | NoneDirectly style the underlying element using CSS. See the styling guide for more details on available style properties.