Skip to main content
TextField(props: { placeholder?: string; text: string; setText: (text: string) => void }): Component;

Parameters

props.placeholder
string
Optional placeholder text displayed when the field is empty.
props.text
string
The current text value of the field.
props.setText
(text: string) => void
Function called when the text changes.

Support

Usage

Basic text field

const [name, setName] = useState("")

TextField({
    placeholder: "Enter your name",
    text: name,
    setText: setName
})

Form with text field

const [email, setEmail] = useState("")

VStack([
    TextField({
        placeholder: "Enter email address",
        text: email,
        setText: setEmail
    }),
    
    Button("Submit", () => {
        console.log("Email:", email)
    })
])