Box
The box printer can be used to put content inside a box to highlight it

Basic Usage

pterm.DefaultBox.Println("Hello, World!")

Options

Name
Type
Description
Title
string
Title of the box
TitleTopLeft
bool
Sets if the title should be displayed on the top left
TitleTopRight
bool
Sets if the title should be displayed on the top right
TitleTopCenter
bool
Sets if the title should be displayed on the top center
TitleBottomLeft
bool
Sets if the title should be displayed on the bottom left
TitleBottomRight
bool
Sets if the title should be displayed on the bottom right
TitleBottomCenter
bool
Sets if the title should be displayed on the bottom center
TextStyle
*Style
Style of the content text
VerticalString
string
Char used for vertical lines
BoxStyle
*Style
Style of the box
HorizontalString
string
Character har used for horizontal lines
TopRightCornerString
string
Character used for the top right corner
TopLeftCornerString
string
Character used for the top left corner
BottomLeftCornerString
string
Character used for the bottom left corner
BottomRightCornerString
string
Character used for the bottom right corner
TopPadding
int
Top space between content and box border
BottomPadding
int
Bottom space between content and box border
RightPadding
int
Right space between content and box border
LeftPadding
int
Left space between content and box border
Writer
io.Writer
Custom 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