SidenavAddUserView()
Adds a user profile header to the sidenav with optional avatar, name, email, and background image. Creates a professional app-style navigation header.
Syntax
Result = MaterialSB::SidenavAddUserView(Name.s, Email.s, AvatarPath.s = "", BackgroundPath.s = "", Parent = #Null)
Parameters
| Name.s | The user's display name. |
| Email.s | The user's email address. |
| AvatarPath.s | Optional. Path to the user's avatar image (displayed as a circle). |
| BackgroundPath.s | Optional. Path to a background image for the header area. |
| Parent | Optional. Parent sidenav element. If #Null, uses the current sidenav. |
Return Value
Returns the list item element containing the user view.
Remarks
The user view should typically be placed at the top of the sidenav before any links. All parameters are optional - you can display just a name, or name and email, etc.
Example
Procedure Main(Success)
If Success
MaterialSB::Navbar(MaterialSB::#Navbar_Shadow2)
MaterialSB::NavbarAddSidenavTrigger("main-sidenav")
MaterialSB::NavbarAddLogo("My App")
mySidenav = MaterialSB::Sidenav()
MaterialSB::SetAttribute(mySidenav, "id", "main-sidenav")
; User view at top of sidenav
MaterialSB::SidenavAddUserView("John Doe", "john.doe@example.com", "images/avatar.jpg", "images/sidebar-bg.jpg")
; Navigation links below user view
MaterialSB::SidenavAddLink("Dashboard", "#dashboard", "dashboard")
MaterialSB::SidenavAddLink("Profile", "#profile", "person")
MaterialSB::SidenavAddLink("Messages", "#messages", "email")
MaterialSB::SidenavAddDivider()
MaterialSB::SidenavAddLink("Settings", "#settings", "settings")
MaterialSB::SidenavAddLink("Logout", "#logout", "exit_to_app")
MaterialSB::Init(mySidenav, #Null)
; Main content
MaterialSB::Row(MaterialSB::#Grid_Container)
MaterialSB::Col(12)
MaterialSB::Append(MaterialSB::Header("Dashboard", 2))
MaterialSB::Append(MaterialSB::Paragraph("Click the menu icon to see the sidenav with user profile."))
MaterialSB::CloseCurrentParent()
MaterialSB::CloseCurrentParent()
EndIf
EndProcedure
MaterialSB::Download(@Main())