Spectre.Console provides various box border styles for panels, rules, and other boxed content. Each border style defines characters for the eight parts of a box structure.
Usage Example
csharp
var panel = new Panel("Hello, World!");
panel.Border(BoxBorder.Rounded);
panel.Header("Welcome");
AnsiConsole.Write(panel);
Important Notes
- Unicode Support: Some border styles use Unicode box-drawing characters. Ensure your terminal supports Unicode.
- Use Cases: Box borders are used in panels, rules, and other container components.
- Custom Borders: You can create custom box borders by inheriting from
BoxBorderand implementingGetPart().
Available Box Borders
Total border styles available: 23
BoxBorder.Ascii
+------------------------------+
| This is a sample panel |
| with multiple lines of |
| content inside the box. |
+------------------------------+
BoxBorder.Beveled
╱▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔╲
▏ This is a sample panel ▕
▏ with multiple lines of ▕
▏ content inside the box. ▕
╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱
BoxBorder.Dashed
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
┆ This is a sample panel ┆
┆ with multiple lines of ┆
┆ content inside the box. ┆
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘
BoxBorder.DashedWide
┌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┐
╎ This is a sample panel ╎
╎ with multiple lines of ╎
╎ content inside the box. ╎
└╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┘
BoxBorder.Dotted
┌┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┐
┊ This is a sample panel ┊
┊ with multiple lines of ┊
┊ content inside the box. ┊
└┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┘
BoxBorder.Double
╔══════════════════════════════╗
║ This is a sample panel ║
║ with multiple lines of ║
║ content inside the box. ║
╚══════════════════════════════╝
BoxBorder.DoubleHorizontal
╒══════════════════════════════╕
│ This is a sample panel │
│ with multiple lines of │
│ content inside the box. │
╘══════════════════════════════╛
BoxBorder.DoubleVertical
╓──────────────────────────────╖
║ This is a sample panel ║
║ with multiple lines of ║
║ content inside the box. ║
╙──────────────────────────────╜
BoxBorder.Heavy
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ This is a sample panel ┃
┃ with multiple lines of ┃
┃ content inside the box. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
BoxBorder.HeavyDashed
┏┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┓
┇ This is a sample panel ┇
┇ with multiple lines of ┇
┇ content inside the box. ┇
┗┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┛
BoxBorder.HeavyDashedWide
┏╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍┓
╏ This is a sample panel ╏
╏ with multiple lines of ╏
╏ content inside the box. ╏
┗╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍┛
BoxBorder.HeavyDotted
┏┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┓
┋ This is a sample panel ┋
┋ with multiple lines of ┋
┋ content inside the box. ┋
┗┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┛
BoxBorder.HeavyHorizontal
┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┑
│ This is a sample panel │
│ with multiple lines of │
│ content inside the box. │
┕━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┙
BoxBorder.HeavyVertical
┎──────────────────────────────┒
┃ This is a sample panel ┃
┃ with multiple lines of ┃
┃ content inside the box. ┃
┖──────────────────────────────┚
BoxBorder.McGuganHorizontal
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
▏ This is a sample panel ▕
▏ with multiple lines of ▕
▏ content inside the box. ▕
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
BoxBorder.McGuganVertical
▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
▕ This is a sample panel ▏
▕ with multiple lines of ▏
▕ content inside the box. ▏
▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
BoxBorder.Near
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
▕ This is a sample panel ▏
▕ with multiple lines of ▏
▕ content inside the box. ▏
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
BoxBorder.None
This is a sample panel
with multiple lines of
content inside the box.
BoxBorder.Rounded
╭──────────────────────────────╮
│ This is a sample panel │
│ with multiple lines of │
│ content inside the box. │
╰──────────────────────────────╯
BoxBorder.RoundedDashed
╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
┆ This is a sample panel ┆
┆ with multiple lines of ┆
┆ content inside the box. ┆
╰┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╯
BoxBorder.RoundedDashedWide
╭╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╮
╎ This is a sample panel ╎
╎ with multiple lines of ╎
╎ content inside the box. ╎
╰╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╯
BoxBorder.RoundedDotted
╭┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╮
┊ This is a sample panel ┊
┊ with multiple lines of ┊
┊ content inside the box. ┊
╰┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈╯
BoxBorder.Square
┌──────────────────────────────┐
│ This is a sample panel │
│ with multiple lines of │
│ content inside the box. │
└──────────────────────────────┘See Also
- Panel Widget - Bordered containers using box borders
- Rule Widget - Horizontal dividers using box borders
- Table Border Reference - Borders for tables