Append()
Appends raw HTML content to an element. This is the primary way to add text, paragraphs, headers, and other HTML content generated by helper functions.
Syntax
MaterialSB::Append(Content.s, Parent = #Null)
Parameters
| Content.s | The HTML content string to append. |
| Parent | Optional. Parent element. If #Null, uses the current parent from the stack. |
Return Value
None.
Remarks
Append() is commonly used with HTML helper functions like Paragraph(), Header(), and Link() which return HTML strings. You can also pass raw HTML strings directly.
The content is appended to the element's innerHTML, so existing content is preserved.
Example
Procedure MyLinkCallback()
MaterialSB::Toast("Link clicked!")
EndProcedure
Procedure Main(Success)
If Success
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12)
; Append a header
MaterialSB::Append(MaterialSB::Header("Welcome to MaterialSB", 2))
; Append paragraphs
MaterialSB::Append(MaterialSB::Paragraph("This is a simple paragraph of text."))
MaterialSB::Append(MaterialSB::Paragraph("This paragraph is colored red.", MaterialSB::#Color_Red))
; Append a header with color
MaterialSB::Append(MaterialSB::Header("Features", 4, MaterialSB::#Color_Blue))
; Append a clickable link
MaterialSB::Append(MaterialSB::Paragraph("Click " + MaterialSB::Link("here", @MyLinkCallback(), MaterialSB::#Color_Teal) + " for more info."))
; Append raw HTML
MaterialSB::Append("
")
MaterialSB::Append("This is raw HTML content with formatting.
")
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())