ModalContent()
Creates the main content section of a modal. This is where you add the modal's body content such as text, forms, and other elements.
Syntax
Result = MaterialSB::ModalContent(Parent = #Null)
Parameters
| Parent | Optional. Parent modal element. If #Null, uses the current modal. |
Return Value
Returns the modal-content div element.
Remarks
Important: ModalContent() pushes to the parent stack. You must call CloseCurrentParent() when done adding content.
For modals with the #Modal_FixedFooter flag, the content area becomes scrollable while the footer stays fixed at the bottom.
Example
Global termsModal
Procedure AcceptTerms()
MaterialSB::ModalClose(termsModal)
MaterialSB::Toast("Terms accepted!")
EndProcedure
Procedure DeclineTerms()
MaterialSB::ModalClose(termsModal)
MaterialSB::Toast("Terms declined")
EndProcedure
Procedure ShowTerms()
MaterialSB::ModalOpen(termsModal)
EndProcedure
Procedure Main(Success)
If Success
; Modal with scrollable content
termsModal = MaterialSB::Modal(MaterialSB::#Modal_FixedFooter)
MaterialSB::ModalHeader("Terms of Service")
MaterialSB::ModalContent()
MaterialSB::Append(MaterialSB::Header("1. Introduction", 5))
MaterialSB::Append(MaterialSB::Paragraph("Welcome to our service. By using this application, you agree to these terms."))
MaterialSB::Append(MaterialSB::Header("2. User Responsibilities", 5))
MaterialSB::Append(MaterialSB::Paragraph("Users must provide accurate information and maintain account security."))
MaterialSB::Append(MaterialSB::Header("3. Privacy Policy", 5))
MaterialSB::Append(MaterialSB::Paragraph("We respect your privacy. Your data will be handled according to our privacy policy."))
MaterialSB::Append(MaterialSB::Header("4. Limitations", 5))
MaterialSB::Append(MaterialSB::Paragraph("The service is provided as-is without warranties of any kind."))
MaterialSB::Append(MaterialSB::Header("5. Changes to Terms", 5))
MaterialSB::Append(MaterialSB::Paragraph("We reserve the right to modify these terms at any time."))
MaterialSB::CloseCurrentParent() ; Close ModalContent
MaterialSB::ModalFooter()
MaterialSB::Button("Decline", @DeclineTerms(), MaterialSB::#Button_Text)
MaterialSB::Button("Accept", @AcceptTerms())
MaterialSB::CloseCurrentParent() ; Close ModalFooter
MaterialSB::Init(termsModal, #Null)
; Main content
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12)
MaterialSB::Button("View Terms of Service", @ShowTerms())
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())