WIP components (as built)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 15:46:20 -04:00
1 parent c804f2ab94
commit d9b11db30c
109 files changed
+6509 -3

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
# 473 UserMenu
用户菜单。
## 用途
头像按钮打开菜单:在线状态、设置与退出登录。头像角标以形状与颜色共同表示状态。
## 最小示例
```go
status := mujica.PresenceOnline
view := func(c *ui.Context) {
mujica.Use(c, mujica.Settings{})
if mujica.UserMenu(c, &status, mujica.UserMenuOptions{Name: "Sakiko Togawa"}).SignOut() {
fmt.Println("sign out")
}
}
ui.Render(view, 400, 300, 1)
```
## 参数
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
| `status` | `*UserStatus` | 必填 | PresenceOnline、PresenceAway、PresenceBusy、PresenceInvisible。 |
| `Name` | `string` | 必填 | 用户名。 |
| `Email` | `string` | "" | 邮箱。 |
| `Avatar` | `*ui.Bitmap` | nil | 头像。 |
| `Disabled` | `bool` | false | 禁用。 |
## 状态
关闭、展开、四种状态、禁用。
## 事件
`StatusChanged()`、`Settings()`、`SignOut()`。
## 键盘操作
Enter/Space/↓ 打开,方向键移动,Enter 选择,Escape 关闭。
## 限制
- 按钮名称包含用户名与状态。