UIViews
TextField
Accept text input in an interactive view.
A controlled text input. Pass the current value and update it from onChange.
import { TextField, useState } from "onescript/views"
function NameField() {
const [name, setName] = useState("")
return (
<TextField
value={name}
onChange={setName}
prompt="Name"
/>
)
}| Prop | Type | Description |
|---|---|---|
value | string | Current text value. |
onChange | (value: string) => void | Runs when the user changes the text. |
prompt | string | Guidance displayed while the value is empty. |
axis | "horizontal" | "vertical" | With "vertical", long text wraps and the field grows taller. Defaults to "horizontal". |
Multiline input
Set axis="vertical" and limit the height with lineLimit. A range reserves the lower bound and scrolls past the upper bound.
import { Modifier, TextField } from "onescript/views"
<TextField
value={bio}
onChange={setBio}
prompt="About you"
axis="vertical"
modifier={Modifier.lineLimit({ min: 2, max: 5 })}
/>For passwords, use SecureField. For long text, use TextEditor.
Also accepts Modifiers. It is interactive in App and Action view sessions. Widget rendering is static, so state updates do not produce another widget render.
How is this guide?
Last updated on