TextInput()
Creates a Material Design text input field with floating label. Supports various input types including text, password, email, number, date, and time.
Syntax
Result = MaterialSB::TextInput(Label.s = "", Placeholder.s = "", Flags = #Input_Default, Parent = #Null)
Parameters
| Label.s | Optional. Floating label text that animates above the input when focused or filled. |
| Placeholder.s | Optional. Placeholder text shown when the input is empty. |
| Flags | Optional. Combination of input flags for type and styling. |
| Parent | Optional. Parent element. If #Null, uses the current parent from the stack. |
Flags
| Flag | Description |
|---|---|
#Input_Default | Standard text input (default) |
#Input_Outlined | Outlined style input field |
#Input_Password | Password input (masked characters) |
#Input_Email | Email input with validation |
#Input_Number | Numeric input |
#Input_Tel | Telephone number input |
#Input_Url | URL input with validation |
#Input_Date | Date picker input |
#Input_Time | Time picker input |
#Input_Disabled | Disabled state |
#Input_Readonly | Read-only state |
Return Value
Returns the input element. Use this reference for GetValue(), SetValue(), and InputSetCallback().
Remarks
Input type flags are mutually exclusive (use only one type flag). You can combine a type flag with style and state flags using the | operator.
Example
Global nameInput, emailInput, passwordInput
Procedure SubmitForm()
Protected name.s, email.s
!v_name = v_nameinput.value;
!v_email = v_emailinput.value;
MaterialSB::Toast("Welcome, " + name + "!")
EndProcedure
Procedure Main(Success)
If Success
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12, 6)
MaterialSB::Card()
MaterialSB::CardContent()
MaterialSB::Append(MaterialSB::Header("Sign Up", 4))
; Standard text input
nameInput = MaterialSB::TextInput("Full Name", "Enter your name")
; Email input
emailInput = MaterialSB::TextInput("Email Address", "", MaterialSB::#Input_Email)
; Password input with outlined style
passwordInput = MaterialSB::TextInput("Password", "", MaterialSB::#Input_Password | MaterialSB::#Input_Outlined)
; Date input
MaterialSB::TextInput("Birth Date", "", MaterialSB::#Input_Date)
MaterialSB::CloseCurrentParent()
MaterialSB::CardAction()
MaterialSB::Button("Sign Up", @SubmitForm())
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())