HorizontalSeparator
Description
The HorizontalSeparator component is used to visually separate content into distinct groups with a horizontal rule. It can display text or custom content (such as an icon combined with text) within the separator. By default, the content is center-aligned, but you can adjust the alignment to Left or Right. This component is ideal for breaking up sections within a UI and enhancing visual organization.
Usage
Instantiate a HorizontalSeparator using the Tesserae.UI helper method. You can provide a string as default text or pass a custom component as its content. Additionally, use method chaining to control alignment and styling.
Methods
HorizontalSeparator SetContent(IComponent component)
Replaces the current content with a custom component.
• component: The custom component to display within the separator.HorizontalSeparator Primary()
Applies the primary styling to the separator (e.g., primary color or emphasis).HorizontalSeparator SetText(string text)
Sets the separator's text content.
• text: The text to display.HorizontalSeparator Left()
Aligns the content of the separator to the left side.HorizontalSeparator Center()
Aligns the content to the center (default).HorizontalSeparator Right()
Aligns the content to the right side.HTMLElement Render()
Renders the component to an HTMLElement for display.
Properties
Align Alignment
Gets or sets the alignment for the separator's content.
Possible values: Align.Left, Align.Center, Align.Right.string Text
Gets or sets the text content of the separator. Changing this value updates the displayed text.string Background
Gets or sets the CSS background style of the separator element.
Samples
Basic Separators
The following sample demonstrates creating horizontal separators with various alignments and both text and custom content.