usermenu

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package usermenu is the identity surface of an application shell: who is logged in, at rest, and what they can do about it, on demand.

Index

Constants

View Source
const (
	PartTrigger  = widget.Part("trigger")
	PartAvatar   = widget.Part("avatar")
	PartName     = widget.Part("name")
	PartPanel    = widget.Part("panel")
	PartRoles    = widget.Part("roles")
	PartRole     = widget.Part("role")
	PartActions  = widget.Part("actions")
	PartBackdrop = widget.Part("backdrop")
)
View Source
const NameUserMenu = widget.Name("usermenu")

NameUserMenu is the widget identity.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserMenu

type UserMenu struct {
	Element

	// Name is who is logged in. The only thing shown at rest beside the avatar.
	Name string

	// Avatar is the URL of their picture. Empty is normal and expected — most
	// systems have no image for most users — and falls back to Fallback.
	Avatar string

	// Roles are display names, not codes. They appear only inside the panel: a
	// shell cannot know how many roles an application defines nor how long
	// their names are, so nothing unbounded may sit in the resting state.
	Roles []string

	// Fallback is the glyph drawn when Avatar is empty. The shell owns it —
	// picking a sprite is a rendering decision and this component has no
	// business making it for its host.
	Fallback svg.Icon

	// Actions holds the user's preferences — a theme toggle, a language picker,
	// a sign-out. Optional; the panel simply omits the section.
	Actions Component
	// contains filtered or unexported fields
}

UserMenu shows who is logged in and, on demand, the roles they hold and the preferences they can change.

It takes plain data, never an interface owned by a shell: this package sits below any layout in the dependency graph, and typing the shell's contract here would invert that. A shell adapts whatever it knows into these fields.

func (*UserMenu) Init

func (m *UserMenu) Init(_ Ctx)

func (*UserMenu) Render

func (m *UserMenu) Render() *Element

func (*UserMenu) RenderCSS

func (m *UserMenu) RenderCSS() *css.Stylesheet

RenderCSS defines the usermenu visual contract using the style DSL.

func (*UserMenu) WidgetKind

func (m *UserMenu) WidgetKind() widget.Kind

func (*UserMenu) WidgetName

func (m *UserMenu) WidgetName() widget.Name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL