Panel
The panel printer can be used to create multiple spaces in the terminal, which can have different content

Basic Usage

// Declare panels in a two dimensional grid system.
panels := pterm.Panels{
{{Data: "This is the first panel"}, {Data: pterm.DefaultHeader.Sprint("Hello, World!")}, {Data: "This\npanel\ncontains\nmultiple\nlines"}},
{{Data: pterm.Red("This is another\npanel line")}, {Data: "This is the second panel\nwith a new line"}},
}
​
// Print panels.
pterm.DefaultPanel.WithPanels(panels).Render()

Options

Name
Type
Description
Panels
Panels
The different panels which should be printed
Padding
int
Padding to the side of the panels
BottomPadding
int
Padding to the bottom of the panels
SameColumnWidth
bool
Sets if every panel should have the same column width
BoxPrinter
BoxPrinter
Sets a box printer, which the panel printer should use to add a border to the panels
Writer
io.Writer
Custom output writer

Using Options

Methods

This printer implements the RenderablePrinter interface.
Method
Description
Render()
Prints to the terminal or uses the specified Writer
Srender()
Returns the rendered string

Full Specification

pkg.go.dev contains the full specification for this printer and more technical descriptions.
pterm package - github.com/pterm/pterm - Go Packages
Last modified 3mo ago
Copy link
Edit on GitHub
On this page
Basic Usage
Options
Using Options
Methods
Full Specification