mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 05:18:16 +08:00
Create panel documentation
This commit is contained in:
61
docs/input/widgets/panel.md
Normal file
61
docs/input/widgets/panel.md
Normal file
@ -0,0 +1,61 @@
|
||||
Title: Panel
|
||||
Order: 0
|
||||
RedirectFrom: panels
|
||||
Description: "The **Panel** widget can be used to organize text into a rendered box."
|
||||
Reference: T:Spectre.Console.Panel
|
||||
|
||||
---
|
||||
|
||||
The `Panel` widget can be used to organize text into a rendered box.
|
||||
|
||||
<?# AsciiCast cast="panel" /?>
|
||||
|
||||
## Usage
|
||||
|
||||
To render a table, create a `Table` instance, passing a string to its constructor to assign the contents.
|
||||
|
||||
```csharp
|
||||
var panel = new Panel("Hello World");
|
||||
```
|
||||
|
||||
## Appearance
|
||||
|
||||
# Headers
|
||||
|
||||
```csharp
|
||||
// Sets the header
|
||||
panel.Header = new PanelHeader("Some text");
|
||||
```
|
||||
|
||||
# Borders
|
||||
|
||||
For a list of borders, see the [Borders](xref:borders) appendix section.
|
||||
|
||||
```csharp
|
||||
// Sets the border
|
||||
panel.Border = BoxBorder.Ascii;
|
||||
panel.Border = BoxBorder.Square;
|
||||
panel.Border = BoxBorder.Rounded;
|
||||
panel.Border = BoxBorder.Heavy;
|
||||
panel.Border = BoxBorder.Double;
|
||||
panel.Border = BoxBorder.None;
|
||||
```
|
||||
|
||||
# Padding
|
||||
|
||||
```csharp
|
||||
// Sets the padding
|
||||
panel.Padding = new Padding(2, 2, 2, 2);
|
||||
```
|
||||
|
||||
# Expand
|
||||
|
||||
Enabling the Expand property will cause the Panel to be as wide as the console.
|
||||
Otherwise, the Panel width will be automatically calculated based on its content.
|
||||
Note that this auto-calculation is not based on the Panel Header, so a Header that
|
||||
is long in length may get truncated with certain content.
|
||||
|
||||
```csharp
|
||||
// Sets the expand property
|
||||
panel.Expand = true;
|
||||
```
|
Reference in New Issue
Block a user