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
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: 6
BoxBorder.Ascii
+------------------------------+
| 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.Heavy
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 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.Square
┌──────────────────────────────┐
│ This is a sample panel │
│ with multiple lines of │
│ content inside the box. │
└──────────────────────────────┘