; MaterialSB Example - Forms
; This example demonstrates all form components available in MaterialSB.
IncludeFile "MaterialSB.sbi"
EnableExplicit
Procedure OnSubmit()
Debug "Form submitted!"
EndProcedure
Procedure Main(Result)
Protected Dropdown, Range
UseModule MaterialSB
SetDarkTheme(#False)
; Create a navbar
Navbar(#Navbar_Shadow1 | #Navbar_Container)
NavbarAddLogo("Form Example")
; Main container
Row(#Grid_Container)
Col(12)
Append("
Form Components
")
Append("MaterialSB provides a complete set of form components styled with MaterializeCSS.
")
CloseCurrentParent(2)
; Text Inputs Section
Row(#Grid_Container)
Col(12, 6)
Append("Text Inputs
")
TextInput("Username", "Enter your username")
TextInput("Email Address", "", #Input_Email)
TextInput("Password", "", #Input_Password)
TextInput("Phone Number", "", #Input_Tel)
TextInput("Disabled Field", "Cannot edit", #Input_Disabled)
CloseCurrentParent()
; Textarea
Col(12, 6)
Append("Textarea
")
Textarea("Biography", "Tell us about yourself...")
Textarea("Read-only Notes", "", #Textarea_Readonly)
CloseCurrentParent(2)
; Checkboxes and Radios
Row(#Grid_Container)
Col(12, 6, 4)
Append("Checkboxes
")
Checkbox("Default checkbox")
Checkbox("Filled checkbox", #Checkbox_Filled)
Checkbox("Pre-checked", #Checkbox_Checked)
Checkbox("Filled & checked", #Checkbox_Filled | #Checkbox_Checked)
Checkbox("Disabled", #Checkbox_Disabled)
CloseCurrentParent()
Col(12, 6, 4)
Append("Radio Buttons
")
Radio("group1","Option 1", #Radio_Checked)
Radio("group1","Option 2")
Radio("group1","Option 3")
Append("
")
Append("With Gap:
")
Radio("group2", "Choice A", #Radio_WithGap | #Radio_Checked)
Radio("group2", "Choice B", #Radio_WithGap)
CloseCurrentParent()
Col(12, 6, 4)
Append("Switches
")
Switch("Off", "On")
Append("
")
Switch("Disabled", "Enabled", #Switch_Checked)
Append("
")
Switch("No", "Yes", #Switch_Disabled)
CloseCurrentParent(2)
; Select and Range
Row(#Grid_Container)
Col(12, 6)
Append("Select Dropdown
")
Dropdown = Dropdown("Choose your country")
DropdownAddOption("Choose an option", "", Dropdown, #True)
DropdownAddOption("France", "fr", Dropdown)
DropdownAddOption("Germany", "de", Dropdown)
DropdownAddOption("United Kingdom", "uk", Dropdown)
DropdownAddOption("Canada", "ca", Dropdown)
DropdownAddOption("Japan", "jp", Dropdown)
Init(Dropdown, #Null)
CloseCurrentParent()
Col(12, 6)
Append("Range Slider
")
Append("Volume:
")
Range = Range(0, 100, 50)
Append("Brightness (0-255):
")
Range(0, 255, 128)
CloseCurrentParent(2)
; Submit Button
Row(#Grid_Container)
Col(12)
Append("
")
Protected submitBtn = Button("Submit Form", #Button_Large)
AddClass(submitBtn, #Color_Green)
ButtonSetCallback(submitBtn, @OnSubmit())
CloseCurrentParent(2)
AutoInit()
UnuseModule MaterialSB
EndProcedure
MaterialSB::Download(@Main())
; IDE Options = SpiderBasic 3.10 (Windows - x86)
; CursorPosition = 12
; Folding = -
; iOSAppOrientation = 0
; AndroidAppCode = 0
; AndroidAppOrientation = 0
; EnableXP
; DPIAware
; CompileSourceDirectory