Table of Contents

Class PanelBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for creating PanelControl instances.

public sealed class PanelBuilder
Inheritance
PanelBuilder
Inherited Members

Methods

Build()

Builds the PanelControl.

public PanelControl Build()

Returns

PanelControl

The configured control.

DoubleLine()

Uses double-line border style.

public PanelBuilder DoubleLine()

Returns

PanelBuilder

The builder for chaining.

FillVertical()

Sets vertical alignment to Fill, causing the panel to stretch vertically.

public PanelBuilder FillVertical()

Returns

PanelBuilder

The builder for chaining.

HeaderCenter()

Centers the header.

public PanelBuilder HeaderCenter()

Returns

PanelBuilder

The builder for chaining.

HeaderLeft()

Aligns the header to the left.

public PanelBuilder HeaderLeft()

Returns

PanelBuilder

The builder for chaining.

HeaderRight()

Aligns the header to the right.

public PanelBuilder HeaderRight()

Returns

PanelBuilder

The builder for chaining.

NoBorder()

Uses no border.

public PanelBuilder NoBorder()

Returns

PanelBuilder

The builder for chaining.

Rounded()

Uses rounded border style.

public PanelBuilder Rounded()

Returns

PanelBuilder

The builder for chaining.

SingleLine()

Uses single-line border style.

public PanelBuilder SingleLine()

Returns

PanelBuilder

The builder for chaining.

StickyBottom()

Makes the control stick to the bottom of the window.

public PanelBuilder StickyBottom()

Returns

PanelBuilder

The builder for chaining.

StickyTop()

Makes the control stick to the top of the window.

public PanelBuilder StickyTop()

Returns

PanelBuilder

The builder for chaining.

StretchHorizontal()

Sets horizontal alignment to Stretch, causing the panel to stretch horizontally.

public PanelBuilder StretchHorizontal()

Returns

PanelBuilder

The builder for chaining.

UseSafeBorder(bool)

Enables safe border characters for better terminal compatibility.

public PanelBuilder UseSafeBorder(bool useSafe = true)

Parameters

useSafe bool

True to use safe borders.

Returns

PanelBuilder

The builder for chaining.

Visible(bool)

Sets the visibility.

public PanelBuilder Visible(bool visible = true)

Parameters

visible bool

True if visible.

Returns

PanelBuilder

The builder for chaining.

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment.

public PanelBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The alignment.

Returns

PanelBuilder

The builder for chaining.

WithBackgroundColor(Color)

Sets the background color.

public PanelBuilder WithBackgroundColor(Color color)

Parameters

color Color

The background color.

Returns

PanelBuilder

The builder for chaining.

WithBorderColor(Color)

Sets the border color.

public PanelBuilder WithBorderColor(Color color)

Parameters

color Color

The border color.

Returns

PanelBuilder

The builder for chaining.

WithBorderStyle(BorderStyle)

Sets the border style for the panel.

public PanelBuilder WithBorderStyle(BorderStyle style)

Parameters

style BorderStyle

The border style.

Returns

PanelBuilder

The builder for chaining.

WithContent(IRenderable)

Sets the content to display inside the panel.

public PanelBuilder WithContent(IRenderable content)

Parameters

content IRenderable

The Spectre renderable content.

Returns

PanelBuilder

The builder for chaining.

WithContent(string)

Sets the content to display inside the panel using markup text.

public PanelBuilder WithContent(string text)

Parameters

text string

The text to display (supports Spectre markup).

Returns

PanelBuilder

The builder for chaining.

WithForegroundColor(Color)

Sets the foreground color.

public PanelBuilder WithForegroundColor(Color color)

Parameters

color Color

The foreground color.

Returns

PanelBuilder

The builder for chaining.

WithHeader(string)

Sets the header text displayed at the top of the panel border.

public PanelBuilder WithHeader(string header)

Parameters

header string

The header text.

Returns

PanelBuilder

The builder for chaining.

WithHeaderAlignment(Justify)

Sets the header alignment.

public PanelBuilder WithHeaderAlignment(Justify alignment)

Parameters

alignment Justify

The header alignment.

Returns

PanelBuilder

The builder for chaining.

WithHeight(int)

Sets the height.

public PanelBuilder WithHeight(int height)

Parameters

height int

The height.

Returns

PanelBuilder

The builder for chaining.

WithMargin(Margin)

Sets the margin.

public PanelBuilder WithMargin(Margin margin)

Parameters

margin Margin

The margin.

Returns

PanelBuilder

The builder for chaining.

WithMargin(int)

Sets uniform margin on all sides.

public PanelBuilder WithMargin(int margin)

Parameters

margin int

The margin value.

Returns

PanelBuilder

The builder for chaining.

WithMargin(int, int, int, int)

Sets the margin.

public PanelBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int

Left margin.

top int

Top margin.

right int

Right margin.

bottom int

Bottom margin.

Returns

PanelBuilder

The builder for chaining.

WithName(string)

Sets the control name for FindControl queries.

public PanelBuilder WithName(string name)

Parameters

name string

The control name.

Returns

PanelBuilder

The builder for chaining.

WithPadding(int)

Sets uniform padding on all sides.

public PanelBuilder WithPadding(int padding)

Parameters

padding int

The padding value.

Returns

PanelBuilder

The builder for chaining.

WithPadding(int, int)

Sets horizontal and vertical padding.

public PanelBuilder WithPadding(int horizontal, int vertical)

Parameters

horizontal int

Horizontal padding (left and right).

vertical int

Vertical padding (top and bottom).

Returns

PanelBuilder

The builder for chaining.

WithPadding(int, int, int, int)

Sets the padding inside the panel border.

public PanelBuilder WithPadding(int left, int top, int right, int bottom)

Parameters

left int

Left padding.

top int

Top padding.

right int

Right padding.

bottom int

Bottom padding.

Returns

PanelBuilder

The builder for chaining.

WithStickyPosition(StickyPosition)

Sets the sticky position.

public PanelBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position.

Returns

PanelBuilder

The builder for chaining.

WithTag(object)

Sets the control tag for custom data storage.

public PanelBuilder WithTag(object tag)

Parameters

tag object

The tag object.

Returns

PanelBuilder

The builder for chaining.

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment.

public PanelBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment.

Returns

PanelBuilder

The builder for chaining.

WithWidth(int)

Sets the width.

public PanelBuilder WithWidth(int width)

Parameters

width int

The width.

Returns

PanelBuilder

The builder for chaining.

Operators

implicit operator PanelControl(PanelBuilder)

Implicit conversion to PanelControl.

public static implicit operator PanelControl(PanelBuilder builder)

Parameters

builder PanelBuilder

Returns

PanelControl