The SecureField component in Scripting provides a secure, private text input field intended for entering sensitive information such as passwords. The entered text is visually obscured and not displayed in plain text, mirroring the behavior of SwiftUI’s SecureField.
This component is useful in authentication forms, PIN inputs, or any context where user privacy is essential.
| Property | Type | Description |
|---|---|---|
title |
string |
A simple string label displayed with the field. (Use either title or label) |
label |
VirtualNode |
A custom view node label. (Use instead of title) |
value |
string |
The current value of the secure text field. |
onChanged |
(value: string) => void |
Callback function invoked when the value changes. |
prompt |
string (optional) |
A placeholder prompt shown when the field is empty. |
autofocus |
boolean (optional) |
Automatically focuses the field on mount. Defaults to false. |
onFocus |
() => void (optional) |
Callback triggered when the field receives focus. |
onBlur |
() => void (optional) |
Callback triggered when the field loses focus. |
In this example:
prompt guides the user when no text is entered.title or label must be provided (but not both).TextField, with added security features for sensitive input.