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
FlagDescription
#Input_DefaultStandard text input (default)
#Input_OutlinedOutlined style input field
#Input_PasswordPassword input (masked characters)
#Input_EmailEmail input with validation
#Input_NumberNumeric input
#Input_TelTelephone number input
#Input_UrlURL input with validation
#Input_DateDate picker input
#Input_TimeTime picker input
#Input_DisabledDisabled state
#Input_ReadonlyRead-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())
See Also

Textarea(), GetValue(), SetValue(), InputSetCallback()