Skip to content

TabItemWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

Represents a single tab within a TabPanel or TabBar. Contains the tab title, optional icon, and content builder.

csharp
public sealed record TabItemWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<TabItemWidget>

Inheritance

ObjectHex1bWidgetTabItemWidget

Implements

Constructors

TabItemWidget(string, Func<WidgetContext<VStackWidget>, IEnumerable<Hex1bWidget>>?)

Represents a single tab within a TabPanel or TabBar. Contains the tab title, optional icon, and content builder.

Parameters:

csharp
public TabItemWidget(string Title, Func<WidgetContext<VStackWidget>, IEnumerable<Hex1bWidget>>? ContentBuilder)

Properties

ContentBuilder

A function that builds the tab content widgets.

Returns: Func<VStackWidget>, Hex1bWidget>>

csharp
public Func<WidgetContext<VStackWidget>, IEnumerable<Hex1bWidget>>? ContentBuilder { get; init; }

Icon

Optional icon displayed before the tab title.

Returns: String

csharp
public string? Icon { get; init; }

IsDisabled

Whether this tab is disabled (cannot be selected).

Returns: Boolean

csharp
public bool IsDisabled { get; init; }

IsSelected

Whether this tab is selected. When multiple tabs have IsSelected=true, the first one wins.

Returns: Boolean

csharp
public bool IsSelected { get; init; }

Title

The title displayed in the tab header.

Returns: String

csharp
public string Title { get; init; }

Methods

Disabled(bool)

Sets whether this tab is disabled.

Parameters:

  • disabled (Boolean): True to disable the tab.

Returns: TabItemWidget

csharp
public TabItemWidget Disabled(bool disabled = true)

LeftActions(Func<WidgetContext<TabItemWidget>, IEnumerable<IconWidget>>)

Adds action icons to the left side of the tab using a builder. Actions are displayed in the order they are added.

Parameters:

Returns: TabItemWidget

csharp
public TabItemWidget LeftActions(Func<WidgetContext<TabItemWidget>, IEnumerable<IconWidget>> builder)

RightActions(Func<WidgetContext<TabItemWidget>, IEnumerable<IconWidget>>)

Adds action icons to the right side of the tab using a builder. Actions are displayed in the order they are added.

Parameters:

Returns: TabItemWidget

csharp
public TabItemWidget RightActions(Func<WidgetContext<TabItemWidget>, IEnumerable<IconWidget>> builder)

Selected(bool)

Marks this tab as selected. When multiple tabs are marked as selected, the first one wins.

Parameters:

  • selected (Boolean): True to select this tab, false otherwise.

Returns: TabItemWidget

csharp
public TabItemWidget Selected(bool selected = true)

WithIcon(string)

Sets the icon for this tab.

Parameters:

  • icon (String): The icon string (emoji or text).

Returns: TabItemWidget

csharp
public TabItemWidget WithIcon(string icon)

Released under the MIT License.