NotificationPanelWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A notification panel widget that hosts notifications and displays them as floating overlays or in a slide-out drawer.
public sealed record NotificationPanelWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<NotificationPanelWidget>Inheritance
Object → Hex1bWidget → NotificationPanelWidget
Implements
Properties
DrawerFloats
Whether the drawer floats on top of content (true) or pushes content aside (false). Defaults to true (floating).
Returns: Boolean
public bool DrawerFloats { get; init; }EnableAnimation
Whether to enable animation for timeout progress bars. Defaults to true.
Returns: Boolean
public bool EnableAnimation { get; init; }MaxFloating
Maximum number of floating notifications to show at once. Defaults to 3.
Returns: Int32
public int MaxFloating { get; init; }OffsetX
Horizontal offset from the right edge for floating notifications. Defaults to 2.
Returns: Int32
public int OffsetX { get; init; }OffsetY
Vertical offset from the top edge for floating notifications. Defaults to 1.
Returns: Int32
public int OffsetY { get; init; }Methods
WithAnimation(bool)
Enables or disables animation for timeout progress bars.
Parameters:
enable(Boolean): True to enable animation (default), false to disable.
Returns: NotificationPanelWidget
A new widget instance with the setting configured.
public NotificationPanelWidget WithAnimation(bool enable = true)WithContent(Hex1bWidget)
Sets the content widget that notifications will overlay.
Parameters:
content(Hex1bWidget): The main content widget.
Returns: NotificationPanelWidget
A new widget instance with the content configured.
public NotificationPanelWidget WithContent(Hex1bWidget content)WithDrawerFloats(bool)
Sets whether the drawer floats on top of content or pushes content aside.
Parameters:
floats(Boolean): True for floating overlay (default), false to push content aside.
Returns: NotificationPanelWidget
A new widget instance with the setting configured.
public NotificationPanelWidget WithDrawerFloats(bool floats = true)WithMaxFloating(int)
Sets the maximum number of floating notifications visible at once.
Parameters:
max(Int32): Maximum floating notifications. Defaults to 3.
Returns: NotificationPanelWidget
A new widget instance with the setting configured.
public NotificationPanelWidget WithMaxFloating(int max)WithOffset(int, int)
Sets the offset from the corner for floating notifications.
Parameters:
x(Int32): Horizontal offset from right edge in columns.y(Int32): Vertical offset from top edge in rows.
Returns: NotificationPanelWidget
A new widget instance with the offsets configured.
public NotificationPanelWidget WithOffset(int x, int y)Fields
ToggleDrawerAction
Returns: ActionId
public static readonly ActionId ToggleDrawerActionRemarks
The notification panel is the container that manages notification display. It wraps your main content and provides: Floating notifications: Appear in the top-right corner as overlay cards.Notification drawer: A slide-out panel showing all notifications.Timeout management: Automatically hides notifications after their timeout.
Typical layout pattern:
ctx.ZStack(z => [
z.VStack(v => [
v.HStack(bar => [
bar.Button("Menu"),
bar.NotificationIcon()
]),
v.NotificationPanel(
v.Text("Your main content here")
).Fill()
])
])Posting notifications: Access the notification stack through the input context and call Post():
ctx.Button("Notify").OnClick(e => {
e.Context.Notifications.Post(
new Notification("Hello!", "This is a notification")
.Timeout(TimeSpan.FromSeconds(5))
);
})Keyboard shortcuts: Alt+N toggles the notification drawer.Escape closes the drawer when open.
Examples
A complete notification-enabled application:
var app = new Hex1bApp(ctx => ctx.ZStack(z => [
z.VStack(v => [
v.HStack(bar => [
bar.Button("File"),
bar.Text("").FillWidth(),
bar.NotificationIcon()
]),
v.NotificationPanel(
v.Button("Show Notification").OnClick(e => {
e.Context.Notifications.Post(
new Notification("Task Complete", "Your task finished successfully")
.Timeout(TimeSpan.FromSeconds(5))
.PrimaryAction("View", async ctx => { /* view result */ })
);
})
).Fill()
])
]));