New-ConsoleColumns
Places console widgets side by side.
Syntax
New-ConsoleColumns
[-CollapseBelow <Int32>]
[[-Content] <Object>]
[-Fill]
[-FixedWidth <Int32[]>]
[-Gap <Int32>]
[-Height <Int32>]
[<CommonParameters>]#All Parameter SetsDescription
Children share the width equally unless they were created with -Weight. -FixedWidth gives children a fixed width in cells instead, by position (a narrow histogram beside two tables). Children in a row share their height. On narrow terminals the columns stack vertically instead of squeezing content: by default below the sum of the children's minimum widths, or below -CollapseBelow cells.
Examples
Example 1
New-ConsoleColumns -Content {
$panelOptions2 = @{
Title = 'Steps'
Weight = 2
Content = { New-ConsoleStatusList -WidgetId steps }
}
New-ConsolePanel @panelOptions2;
$panelOptions = @{
Title = 'Info'
Content = { New-ConsoleKeyValue -WidgetId info }
}
New-ConsolePanel @panelOptions
}Two panels, the first twice as wide
Example 2
$columnsOptions = @{
FixedWidth = @(0, 0, 17)
CollapseBelow = 90
Content = {
$panelOptions3 = @{
Title = 'Failures'
Weight = 1.5
Content = {
$tableOptions2 = @{
Live = $true
WidgetId = 'failures'
Property = @('Server', 'Check')
}
New-ConsoleTable @tableOptions2
}
}
New-ConsolePanel @panelOptions3
$panelOptions2 = @{
Title = 'Slowest'
Content = {
$tableOptions = @{
Live = $true
WidgetId = 'slowest'
Property = @('Check', 'Took')
}
New-ConsoleTable @tableOptions
}
}
New-ConsolePanel @panelOptions2
$panelOptions = @{
Title = 'Durations'
Content = {
$chartOptions = @{
WidgetId = 'durations'
Height = 5
Type = 'Histogram'
Edges = @(0, 2, 4, 8)
}
New-ConsoleChart @chartOptions
}
}
New-ConsolePanel @panelOptions
}
}
New-ConsoleColumns @columnsOptionsKeep the histogram at 17 cells and distribute the rest of the width between the two tables. FixedWidth is indexed in the order that Content emits its children: 0 leaves Failures and Slowest on their weighted shares, and 17 fixes Durations. Below 90 cells, CollapseBelow stacks the three children vertically.
Example 3
Get-ConsoleDemo -Slug 'disk-usage' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'event-log-summary' | Select-Object -ExpandProperty SourceRead any of these gallery scripts to see New-ConsoleColumns in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.
Parameters
- -CollapseBelow Int32
- The width in cells below which the columns stack vertically (default: the sum of the children's minimum widths, counting 16 cells for each shared column).
- -Content Object
- Scriptblock that emits the child widgets.
- -Fill SwitchParameter
- Take the remaining height of a live dashboard.
- -FixedWidth Int32[]
- Fixed widths in cells, one per child in order; 0 (or no entry) keeps the child's share of the width (-Weight).
- -Gap Int32
- Blank columns between children (default 1).
- -Height Int32
- Fixed height in rows for this row of columns.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.