DrawerWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A collapsible panel widget that can be placed at the edge of an HStack or VStack. In collapsed state, it shows minimal content (or nothing). In expanded state, it shows full content with collapse/dock controls.
public sealed record DrawerWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<DrawerWidget>Inheritance
Object → Hex1bWidget → DrawerWidget
Implements
Properties
IsExpanded
Whether the drawer is expanded. When null, the node manages its own state. When set, the drawer syncs to this value (user-controlled state).
Returns: Nullable<Boolean>
public bool? IsExpanded { get; init; }Mode
The current rendering mode for the expanded drawer.
Returns: DrawerMode
public DrawerMode Mode { get; init; }Methods
AsInline()
Sets the drawer to render inline (pushes adjacent content).
Returns: DrawerWidget
public DrawerWidget AsInline()AsOverlay()
Sets the drawer to render as an overlay (floats above content).
Returns: DrawerWidget
public DrawerWidget AsOverlay()Collapsed(bool)
Sets the drawer to collapsed state.
Parameters:
collapsed(Boolean): Whether the drawer should be collapsed.
Returns: DrawerWidget
public DrawerWidget Collapsed(bool collapsed = true)CollapsedContent(Func<WidgetContext<DrawerWidget>, IEnumerable<Hex1bWidget>>)
Sets the content to display when the drawer is collapsed.
Parameters:
builder(Func<DrawerWidget>, Hex1bWidget>>): A function that returns the collapsed content widgets.
Returns: DrawerWidget
public DrawerWidget CollapsedContent(Func<WidgetContext<DrawerWidget>, IEnumerable<Hex1bWidget>> builder)Expanded(bool)
Sets the drawer to expanded state.
Parameters:
expanded(Boolean): Whether the drawer should be expanded.
Returns: DrawerWidget
public DrawerWidget Expanded(bool expanded = true)ExpandedContent(Func<WidgetContext<DrawerWidget>, IEnumerable<Hex1bWidget>>)
Sets the content to display when the drawer is expanded.
Parameters:
builder(Func<DrawerWidget>, Hex1bWidget>>): A function that returns the expanded content widgets.
Returns: DrawerWidget
public DrawerWidget ExpandedContent(Func<WidgetContext<DrawerWidget>, IEnumerable<Hex1bWidget>> builder)OnCollapsed(Action)
Sets the handler to call when the drawer collapses.
Parameters:
handler(Action):
Returns: DrawerWidget
public DrawerWidget OnCollapsed(Action handler)OnExpanded(Action)
Sets the handler to call when the drawer expands.
Parameters:
handler(Action):
Returns: DrawerWidget
public DrawerWidget OnExpanded(Action handler)OverlayBackground(Hex1bColor)
Sets the background color for the overlay popup content. This is required when the overlay needs an opaque background to prevent content from layers below bleeding through.
Parameters:
color(Hex1bColor):
Returns: DrawerWidget
public DrawerWidget OverlayBackground(Hex1bColor color)WithMode(DrawerMode)
Sets the rendering mode for the expanded drawer.
Parameters:
mode(DrawerMode): The rendering mode (Inline or Overlay).
Returns: DrawerWidget
public DrawerWidget WithMode(DrawerMode mode)Fields
OpenAction
Returns: ActionId
public static readonly ActionId OpenActionToggleAction
Returns: ActionId
public static readonly ActionId ToggleActionRemarks
The drawer supports two rendering modes when expanded:
- Pushes adjacent content (like VS Code sidebar) - Floats above content (like mobile hamburger menus)
The expansion direction is auto-detected based on the drawer's position in the parent stack.