Expander

Description

A single expand / collapse section, with a clickable header that reveals its body content. Used standalone for "show more" affordances, or grouped inside an Accordion.

Usage

API reference

class

Expander

public sealed class Expander : ComponentBase<Expander, HTMLElement>

A single expand / collapse section, with a clickable header that reveals its body content.

Namespace
Tesserae
Inheritance
ComponentBase<Expander, HTMLElement> → Expander

Constructors

NameDescription
ExpanderInitializes a new instance of this class.
Constructor
Expander
public Expander(string title = null, IComponent content = null)

Initializes a new instance of this class.

Properties

NameDescription
IsExpandedGets or sets whether the expander is expanded.
TitleGets or sets the title text when no custom header is provided.
Property
Expander.IsExpanded
public bool IsExpanded { get ; set ; }

Gets or sets whether the expander is expanded.

Property
Expander.Title
public string Title { get ; set ; }

Gets or sets the title text when no custom header is provided.

Methods

NameDescription
SetTitleSets the title of the component.
SetHeaderSets the header of the component.
SetContentSets the content of the component.
OptionIconConfigures the option icon on the component.
ChevronRightConfigures the chevron right on the component.
ExpandedExpands the component.
CollapseCollapses the component.
ExpandExpands the component.
ToggleToggles the component's state.
OnToggleRegisters a callback invoked when the toggle event fires.
OnExpandRegisters a callback invoked when the expand event fires.
OnCollapseRegisters a callback invoked when the collapse event fires.
RenderRenders the component's root HTML element.
Method
Expander.SetTitle
public Expander SetTitle(string title)

Sets the title of the component.

Method
Expander.SetHeader
public Expander SetHeader(IComponent header)

Sets the header of the component.

Method
Expander.SetContent
public Expander SetContent(IComponent content)

Sets the content of the component.

Method
Expander.OptionIcon
public Expander OptionIcon(UIcons icon, string color = "", string background = "")

Configures the option icon on the component.

Method
Expander.ChevronRight
public Expander ChevronRight()

Configures the chevron right on the component.

Method
Expander.Expanded
public Expander Expanded(bool value = true)

Expands the component.

Method
Expander.Collapse
public Expander Collapse()

Collapses the component.

Method
Expander.Expand
public Expander Expand()

Expands the component.

Method
Expander.Toggle
public Expander Toggle()

Toggles the component's state.

Method
Expander.OnToggle
public Expander OnToggle(Action<Expander> onToggle)

Registers a callback invoked when the toggle event fires.

Method
Expander.OnExpand
public Expander OnExpand(Action<Expander> onExpand)

Registers a callback invoked when the expand event fires.

Method
Expander.OnCollapse
public Expander OnCollapse(Action<Expander> onCollapse)

Registers a callback invoked when the collapse event fires.

Method
Expander.Render
public override HTMLElement Render()

Renders the component's root HTML element.

See also

© 2026 Curiosity. All rights reserved.