NotificationIconWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A notification bell icon widget that displays the notification count and toggles the drawer.
public sealed record NotificationIconWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<NotificationIconWidget>Inheritance
Object → Hex1bWidget → NotificationIconWidget
Implements
Properties
BellCharacter
The bell character to display. Defaults to "🔔".
Returns: String
public string BellCharacter { get; init; }ShowCount
Whether to show the notification count badge next to the bell. Defaults to true.
Returns: Boolean
public bool ShowCount { get; init; }Methods
WithBell(string)
Sets the bell character to display.
Parameters:
bell(String): The character or string to use as the bell icon.
Returns: NotificationIconWidget
A new widget instance with the bell character configured.
public NotificationIconWidget WithBell(string bell)WithCount(bool)
Sets whether to show the notification count badge.
Parameters:
show(Boolean): True to show the count (default), false to hide it.
Returns: NotificationIconWidget
A new widget instance with the setting configured.
public NotificationIconWidget WithCount(bool show = true)Fields
TogglePanelAction
Returns: ActionId
public static readonly ActionId TogglePanelActionRemarks
The notification icon displays a bell character (🔔 by default) followed by the unread notification count. When clicked or activated with Enter, it toggles the notification drawer.
Requirements: This widget must be placed inside a subtree to function correctly. It automatically discovers the parent panel's notification stack.
Keyboard shortcuts: Alt+N toggles the notification drawer from anywhere in the app.Enter or Space activates the icon when focused.
Examples
A typical menu bar with notification icon:
ctx.ZStack(z => [
z.VStack(v => [
v.HStack(bar => [
bar.Button("File"),
bar.Button("Edit"),
bar.Text("").FillWidth(), // Spacer
bar.NotificationIcon()
]),
v.NotificationPanel(
v.Text("Main content here")
).Fill()
])
])