Tesserae

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.

API reference

class

HorizontalSeparator

public class HorizontalSeparator : IComponent, IHasBackgroundColor

A thin horizontal divider used to separate sections of a vertically stacked layout.

Constructors

Constructor
HorizontalSeparator
public HorizontalSeparator(string text = string.Empty)

Initializes a new instance of this class.

Constructor
HorizontalSeparator
public HorizontalSeparator(IComponent component)

Initializes a new instance of this class.

Properties

Property
HorizontalSeparator.Alignment
public Align Alignment { get ; set ; }

Gets or sets the alignment.

Property
HorizontalSeparator.Text
public string Text { get ; set ; }

Gets or sets the text shown in the component.

Property
HorizontalSeparator.Background
public string Background { get ; set ; }

Gets or sets the CSS background of the component.

Methods

Method
HorizontalSeparator.SetContent
public HorizontalSeparator SetContent(IComponent component)

Sets the content of the component.

Method
HorizontalSeparator.Primary
public HorizontalSeparator Primary()

Styles the component using the primary tone.

Method
HorizontalSeparator.SetText
public HorizontalSeparator SetText(string text)

Sets the text of the component.

Method
HorizontalSeparator.Render
public HTMLElement Render()

Renders the component's root HTML element.

Method
HorizontalSeparator.Left
public HorizontalSeparator Left()

Aligns the content of the component to the left.

Method
HorizontalSeparator.Center
public HorizontalSeparator Center()

Centers the content of the component.

Method
HorizontalSeparator.Right
public HorizontalSeparator Right()

Aligns the content of the component to the right.

Samples

Basic Separators

The following sample demonstrates creating horizontal separators with various alignments and both text and custom content.

See also

Referenced by

© 2026 Tesserae. All rights reserved.