Table of Contents

Class TwTable

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Represents a customizable table component for Blazor applications that enables rendering of table headers, body, and footers with configurable styling and behaviour.

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

Remarks

The TwTable component provides flexibility for displaying tabular data by allowing developers to supply custom content for the header, body, and footer sections using RenderFragment parameters. It supports additional styling options such as striped rows, hover effects, and borders, which can be controlled through component parameters. Additional CSS classes can be applied to each section for further customization. This component is intended to be used as a building block for creating accessible and visually consistent tables in Blazor projects.

Constructors

TwTable()

public TwTable()

Properties

BodyClass

Additional CSS classes for the body section.

[Parameter]
public string? BodyClass { get; set; }

Property Value

string

Bordered

Whether to show borders on all cells.

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

Property Value

bool

Caption

Optional caption content for the table, rendered as a <caption> element. Provides an accessible name/description for the table that is programmatically associated with it. Visually hidden by default (via the sr-only class) unless CaptionVisible is set to true.

[Parameter]
public RenderFragment? Caption { get; set; }

Property Value

RenderFragment

CaptionVisible

Whether the Caption should be visible. Defaults to false, rendering the caption visually hidden (but still available to assistive technology).

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

Property Value

bool

FooterClass

Additional CSS classes for the footer section.

[Parameter]
public string? FooterClass { get; set; }

Property Value

string

HeaderClass

Additional CSS classes for the header section.

[Parameter]
public string? HeaderClass { get; set; }

Property Value

string

Hoverable

Whether to show hover effect on rows.

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

Property Value

bool

NoBorder

Whether to hide the outer table border.

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

Property Value

bool

Striped

Whether to show striped rows.

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

Property Value

bool

TableBody

Content to render in the table body (tbody).

[Parameter]
public RenderFragment? TableBody { get; set; }

Property Value

RenderFragment

TableFooter

Content to render in the table footer (tfoot).

[Parameter]
public RenderFragment? TableFooter { get; set; }

Property Value

RenderFragment

TableHeader

Content to render in the table header (thead).

[Parameter]
public RenderFragment? TableHeader { get; set; }

Property Value

RenderFragment

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder