Format-SpectrePanel
Description
This function takes a string and formats it as a Spectre Console panel with optional title, border, and color. The resulting panel can be displayed in the console using the Write-Host command.
See https://spectreconsole.net/widgets/panel for more information.
Examples
Example 1
This example demonstrates how to display a panel with a title and a rounded border.
Example 2
This example demonstrates how to display a panel with a title and a double border that’s expanded to take up the whole console width.
Parameters
Data
The renderable item to be formatted as a panel.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Object] | true | 1 | true (ByValue) |
Header
The title to be displayed at the top of the panel.
Type | Required | Position | PipelineInput | Aliases |
---|---|---|---|---|
[String] | false | 2 | false | Title |
Border
The type of border to be displayed around the panel.
Valid Values:
- Ascii
- Double
- Heavy
- None
- Rounded
- Square
Type | Required | Position | PipelineInput |
---|---|---|---|
[String] | false | 3 | false |
Expand
Switch parameter that specifies whether the panel should be expanded to fill the available space.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Switch] | false | named | false |
Color
The color of the panel border.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Color] | false | 4 | false |
Width
The width of the panel.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Int32] | false | 5 | false |
Height
The height of the panel.
Type | Required | Position | PipelineInput |
---|---|---|---|
[Int32] | false | 6 | false |