Tesserae

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.

Constructors

Constructor
Accordion
public Accordion(params Expander[] items)

Initializes a new instance of this class.

Properties

Property
Accordion.AllowMultiple
public bool AllowMultiple { get ; set ; }

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

Methods

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.

Constructors

Constructor
Expander
public Expander(string title = null, IComponent content = null)

Initializes a new instance of this class.

Properties

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

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

Referenced by

© 2026 Tesserae. All rights reserved.