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
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
| Name | Description |
|---|---|
| Accordion | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| AllowMultiple | Gets or sets whether multiple sections can be expanded at once. |
Methods
| Name | Description |
|---|---|
| AddItem | Adds the given item to the component. |
| AddItems | Adds the given items to the component. |
| Items | Adds the given items to the component. |
| AllowMultipleOpen | Allows the multiple open. |
| Render | Renders the component's root HTML element. |
public Accordion AddItems(params Expander[] items)Adds the given items to the component.
public Accordion Items(params Expander[] items)Adds the given items to the component.
public Accordion AllowMultipleOpen(bool value = true)Allows the multiple open.
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
| Name | Description |
|---|---|
| Expander | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| IsExpanded | Gets or sets whether the expander is expanded. |
| Title | Gets or sets the title text when no custom header is provided. |
public bool IsExpanded { get ; set ; }Gets or sets whether the expander is expanded.
Methods
| Name | Description |
|---|---|
| SetTitle | Sets the title of the component. |
| SetHeader | Sets the header of the component. |
| SetContent | Sets the content of the component. |
| OptionIcon | Configures the option icon on the component. |
| ChevronRight | Configures the chevron right on the component. |
| Expanded | Expands the component. |
| Collapse | Collapses the component. |
| Expand | Expands the component. |
| Toggle | Toggles the component's state. |
| OnToggle | Registers a callback invoked when the toggle event fires. |
| OnExpand | Registers a callback invoked when the expand event fires. |
| OnCollapse | Registers a callback invoked when the collapse event fires. |
| Render | Renders the component's root HTML element. |
public Expander SetHeader(IComponent header)Sets the header of the component.
public Expander SetContent(IComponent content)Sets the content of the component.
public Expander OptionIcon(UIcons icon, string color = "", string background = "")Configures the option icon on the component.
public Expander ChevronRight()Configures the chevron right on the component.
public Expander OnToggle(Action<Expander> onToggle)Registers a callback invoked when the toggle event fires.
public Expander OnExpand(Action<Expander> onExpand)Registers a callback invoked when the expand event fires.
public Expander OnCollapse(Action<Expander> onCollapse)Registers a callback invoked when the collapse event fires.