Table of Contents

Class TwTab

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Represents a tab within a tab container, allowing users to navigate between different content sections.

public class TwTab : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
Inheritance
TwTab
Implements
Inherited Members

Remarks

A TwTab is typically used as a child of a TwTabContainer component. The tab can be enabled or disabled using the Disabled property, and its appearance can be customized with the Color property. The tab's label is displayed to the user, and it is activated by the parent tab container. Only one tab is active at a time within a container.

Constructors

TwTab()

public TwTab()

Properties

ChildContent

The content to be displayed when this tab is active. This is a required parameter and should contain the markup or components that make up the tab's content.

[Parameter]
public required RenderFragment ChildContent { get; set; }

Property Value

RenderFragment

Color

The color of the tab, which can be set to customize its appearance. If not specified, it will inherit the color from the parent tab container.

[Parameter]
public Color? Color { get; set; }

Property Value

Color?

Disabled

Gets or sets a value indicating whether the component is disabled and cannot be interacted with by the user.

[Parameter]
public bool Disabled { get; set; }

Property Value

bool

Remarks

When set to true, the component will not respond to user input. This is typically used to prevent interaction during loading states or when certain conditions are not met.

Label

The label to display for this tab. This is a required parameter and is used to identify the tab in the user interface.

[Parameter]
public required string Label { get; set; }

Property Value

string

Parent

The parent tab container that this tab belongs to. This property is required and is set via cascading parameters.

[CascadingParameter]
public required TwTabContainer Parent { get; set; }

Property Value

TwTabContainer

TabClasses

Gets the CSS classes that are applied to the tab element based on its current state and configuration.

public string TabClasses { get; }

Property Value

string

Remarks

The returned class string reflects the tab's active, disabled, and dense states, as well as color and text options provided by the parent component. These classes control the tab's appearance, including padding, text styling, and interactive effects.

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

OnInitialized()

Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.

protected override void OnInitialized()