NavbarAddLink()
Adds a navigation link to the navbar. Links are automatically added to both the desktop menu and a responsive mobile dropdown.
Syntax
Result = MaterialSB::NavbarAddLink(Text.s, Link.s, Parent = #Null)
Parameters
| Text.s | The link text to display. |
| Link.s | The URL or anchor to navigate to. |
| Parent | Optional. Parent navbar element. |
Return Value
Returns the link list item element.
Remarks
MaterialSB automatically creates a responsive layout: links are shown horizontally on large screens and collapsed into a dropdown menu on medium and small screens.
The first link added creates both the desktop list and the mobile dropdown. Subsequent links are added to both automatically.
Example
Procedure Main(Success)
If Success
MaterialSB::Navbar(MaterialSB::#Navbar_Shadow2 | MaterialSB::#Navbar_Container)
MaterialSB::NavbarAddLogo("My Website")
; Add navigation links
MaterialSB::NavbarAddLink("Home", "#home")
MaterialSB::NavbarAddLink("Features", "#features")
MaterialSB::NavbarAddLink("Pricing", "#pricing")
MaterialSB::NavbarAddLink("About", "#about")
MaterialSB::NavbarAddLink("Contact", "#contact")
; Main content
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12)
MaterialSB::Append(MaterialSB::Header("Welcome", 2))
MaterialSB::Append(MaterialSB::Paragraph("Resize the browser window to see the responsive navbar in action."))
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())