Accordion

Description

A collapsible content component

An accordion contains a list of expanders that can be toggled to reveal more information. They are useful for organizing content into manageable chunks and reducing vertical space usage when not all information needs to be visible at once.

Tesserae's Accordion component manages multiple Expanders, allowing you to control whether one or multiple sections can be open at the same time.

API reference

class

Accordion

public sealed class Accordion : ComponentBase<Accordion, HTMLElement>

A vertically-stacked list of expandable sections, of which one or more may be open at a time.

Namespace
Tesserae
Inheritance
ComponentBase<Accordion, HTMLElement> → Accordion

Constructors

NameDescription
AccordionInitializes a new instance of this class.
Constructor
Accordion
public Accordion(params Expander[] items)

Initializes a new instance of this class.

Properties

NameDescription
AllowMultipleGets or sets whether multiple sections can be expanded at once.
Property
Accordion.AllowMultiple
public bool AllowMultiple { get ; set ; }

Gets or sets whether multiple sections can be expanded at once.

Methods

NameDescription
AddItemAdds the given item to the component.
AddItemsAdds the given items to the component.
ItemsAdds the given items to the component.
AllowMultipleOpenAllows the multiple open.
RenderRenders the component's root HTML element.
Method
Accordion.AddItem
public Accordion AddItem(Expander item)

Adds the given item to the component.

Method
Accordion.AddItems
public Accordion AddItems(params Expander[] items)

Adds the given items to the component.

Method
Accordion.Items
public Accordion Items(params Expander[] items)

Adds the given items to the component.

Method
Accordion.AllowMultipleOpen
public Accordion AllowMultipleOpen(bool value = true)

Allows the multiple open.

Method
Accordion.Render
public override HTMLElement Render()

Renders the component's root HTML element.

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.

Samples

Basic Accordion

Accordion with Multiple Open Allowed

Standalone Expander

Expander with OptionIcon and ChevronRight

See also

© 2026 Curiosity. All rights reserved.