Card

Description

A card component with optional headers and footers

Cards are surfaces that display content and actions on a single topic.

They should be easy to scan for relevant and actionable information. Elements, like text and images, should be placed on them in a way that clearly indicates hierarchy.

Cards can contain different types of components. They can be used to show a list of items, a single item, or a mix of both.

API reference

class

Card

public sealed class Card : ComponentBase<Card, HTMLElement>, IHasBackgroundColor, IRoundedStyle

A bordered, shadowed surface used to group related content into a self-contained block.

Namespace
Tesserae
Inheritance
ComponentBase<Card, HTMLElement> → Card
Implements
IHasBackgroundColor, IRoundedStyle

Constructors

NameDescription
CardInitializes a new instance of this class.
Constructor
Card
public Card(IComponent content, bool noAnimation = false)

Initializes a new instance of this class.

Properties

NameDescription
IsCompactGets or set whenever the card is rendered in a compact form
BackgroundGets or sets the CSS background of the component.
Property
Card.IsCompact
public bool IsCompact { get ; set ; }

Gets or set whenever the card is rendered in a compact form

Property
Card.Background
public string Background { get ; set ; }

Gets or sets the CSS background of the component.

Methods

NameDescription
EnsureLayoutGets or set whenever the card is rendered in a compact form
OnClickRegisters a callback invoked when the click event fires.
SetTitleSets the title of the component.
SetContentSets the content of the component.
SetFooterSets the footer of the component.
CompactRenders the component in a compact form.
BackgroundColorSets the background colour of the card.
BorderConfigures the component to border.
NoPaddingRemoves / disables the padding on the component.
HoverColorEnables or disables the hover colour overlay on the card.
RenderRenders the component's root HTML element.
Method
Card.EnsureLayout
private void EnsureLayout()

Gets or set whenever the card is rendered in a compact form

Method
Card.OnClick
Overload
OnClick(ComponentEventHandler<Card, MouseEvent>, bool)Registers a callback invoked when the click event fires.
OnClick(Action)Registers a callback invoked when the click event fires.
OnClick(ComponentEventHandler<Card, MouseEvent>, bool)
public override Card OnClick(ComponentEventHandler<Card, MouseEvent> onClick, bool clearPrevious = true)

Registers a callback invoked when the click event fires.

Parameters

onClick ComponentEventHandler<Card, MouseEvent>
clearPrevious bool
OnClick(Action)
public Card OnClick(Action action)

Registers a callback invoked when the click event fires.

Parameters

action Action
Method
Card.SetTitle
Overload
SetTitle(string)Sets the title of the component.
SetTitle(IComponent)Sets the title of the component.
SetTitle(string)
public Card SetTitle(string title)

Sets the title of the component.

Parameters

title string
SetTitle(IComponent)
public Card SetTitle(IComponent title)

Sets the title of the component.

Parameters

title IComponent
Method
Card.SetContent
public Card SetContent(IComponent content)

Sets the content of the component.

Method
Card.SetFooter
public Card SetFooter(IComponent footer)

Sets the footer of the component.

Method
Card.Compact
public Card Compact()

Renders the component in a compact form.

Method
Card.BackgroundColor
public Card BackgroundColor(string color)

Sets the background colour of the card.

Method
Card.Border
public Card Border(string color, UnitSize size = null)

Configures the component to border.

Method
Card.NoPadding
public Card NoPadding()

Removes / disables the padding on the component.

Method
Card.HoverColor
public Card HoverColor(bool enabled = true)

Enables or disables the hover colour overlay on the card.

Method
Card.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Samples

Basic Card

Card with Header

Compact Card

Hover Card

Custom Background

See also

© 2026 Curiosity. All rights reserved.