Table of Contents

Class TwCard

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

Represents a card component that provides a contained surface for grouping related content.

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

Remarks

The TwCard component uses the Surface Container theme tokens by default (bg-gray-100 dark:bg-gray-800) with On Surface text colours. It supports an optional title, optional header/footer sections, and respects the global shadow and rounded corner configuration.

Constructors

TwCard()

public TwCard()

Properties

Bordered

Gets or sets whether the card has a visible border.

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

Property Value

bool

Remarks

When true, applies the Outline Variant token (border-gray-200 dark:border-gray-700). Default is true.

ChildContent

Gets or sets the main content of the card.

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

Property Value

RenderFragment

HeaderContent

Gets or sets custom header content rendered below the title.

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

Property Value

RenderFragment

Title

Gets or sets the title text displayed at the top of the card.

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

Property Value

string

Remarks

When provided, renders as a heading inside the card header area. If HeaderContent is also provided, the title is rendered before it.

TitleLevel

Gets or sets the heading level (1-6) rendered for Title, so the card's heading can fit correctly into the surrounding page's heading outline instead of always being an <h3> regardless of context. Defaults to 3.

[Parameter]
public int TitleLevel { get; set; }

Property Value

int

Methods

BuildRenderTree(RenderTreeBuilder)

Renders the component to the supplied RenderTreeBuilder.

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder