Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-HTMLSection

Aliases: New-HTMLContent
Namespace PSWriteHTML
Aliases
New-HTMLContent

Creates a new HTML section with customizable styling options.

Remarks

The New-HTMLSection function creates a new HTML section with various customizable styling options such as text alignment, background color, flexbox properties, and more.

Examples

Authored help example

EXAMPLE 1


New-HTMLSection -Content { "This is the content of the section." } -HeaderText "Section Title" -HeaderTextColor "blue" -HeaderTextSize "20px" -HeaderTextAlignment "center" -HeaderBackGroundColor "lightgray" -BackgroundColor "white" -CanCollapse -Height "200px" -Width "50%" -Wrap "wrap" -Direction "row" -AlignContent "center" -AlignItems "center" -JustifyContent "flex-start" -BorderRadius "10px" -AnchorName "section1" -StyleSheetsConfiguration @{ Section = 'customSection'; SectionText = 'customSectionText' }
        

EXAMPLE 2


New-HTMLSection -HeaderText "Cards with Responsive Layout" -Density Comfortable {
    New-HTMLInfoCard -Title "Card 1" -Number 100 -Icon "📊"
    New-HTMLInfoCard -Title "Card 2" -Number 200 -Icon "📈"
    # Cards will automatically wrap and maintain comfortable spacing
}
        

EXAMPLE 3


$content = {
    "This is a sample content."
}
New-HTMLSection -Content $content -HeaderText "Sample Section" -HeaderTextColor "red" -HeaderTextSize "18px" -HeaderTextAlignment "left" -HeaderBackGroundColor "lightblue" -BackgroundColor "lightyellow" -Height "150px" -Wrap "nowrap" -Direction "column" -AlignContent "flex-start" -AlignItems "flex-start" -JustifyContent "center" -BorderRadius "5px" -AnchorName "sampleSection" -StyleSheetsConfiguration @{ Section = 'customSection'; SectionText = 'customSectionText' }
        

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.

Syntax

New-HTMLSection [-AlignContent <flex-start>] [-AlignItems <stretch|flex-start|flex-end|center|baseline>] [-AnchorName <String>] [-BackgroundColor <String>] [-BorderRadius <0px>] [-CanCollapse] [-Collapsed] [-Content <ScriptBlock>] [-Density <Spacious|Comfortable|Compact|Dense|VeryDense>] [-Direction <row|row-reverse|column|column-reverse>] [-HeaderBackGroundColor <String>] [-HeaderText <String>] [-HeaderTextAlignment <center|left|right|justify>] [-HeaderTextColor <String>] [-HeaderTextSize <String>] [-Height <Object>] [-Invisible] [-IsHidden] [-JustifyContent <flex-start|flex-end|center>] [-Margin <Object>] [-StyleSheetsConfiguration <IDictionary>] [-Width <Object>] [-Wrap <wrap|nowrap|wrap-reverse>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AlignContent String optionalposition: namedpipeline: Falsevalues: 6
Specifies the align-content property. Valid values are 'flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'.
Possible values: flex-start, flex-end, center, space-between, space-around, stretch
AlignItems String optionalposition: namedpipeline: Falsevalues: 5
Specifies the align-items property. Valid values are 'stretch', 'flex-start', 'flex-end', 'center', 'baseline'.
Possible values: stretch, flex-start, flex-end, center, baseline
AnchorName String optionalposition: namedpipeline: False
Specifies the anchor name for the section.
BackgroundColor String optionalposition: namedpipeline: Falsealiases: BackgroundShade
Specifies the background color of the section.
BorderRadius String optionalposition: namedpipeline: Falsevalues: 6
Specifies the border radius of the section. Valid values are '0px', '5px', '10px', '15px', '20px', '25px'.
Possible values: 0px, 5px, 10px, 15px, 20px, 25px
CanCollapse SwitchParameter optionalposition: namedpipeline: Falsealiases: Collapsable
Indicates whether the section can be collapsed.
Collapsed SwitchParameter optionalposition: namedpipeline: False
Indicates whether the section is collapsed.
Content ScriptBlock optionalposition: 0pipeline: False
Specifies the content of the HTML section as a ScriptBlock.
Density String optionalposition: namedpipeline: Falsevalues: 5
Specifies the density of the panel. This will automatically enable responsive wrapping for the panel. The options are: Spacious, Comfortable, Compact, Dense, VeryDense.
Possible values: Spacious, Comfortable, Compact, Dense, VeryDense
Direction String optionalposition: namedpipeline: Falsevalues: 4
Specifies the flex-direction property. Valid values are 'row', 'row-reverse', 'column', 'column-reverse'.
Possible values: row, row-reverse, column, column-reverse
HeaderBackGroundColor String optionalposition: namedpipeline: Falsealiases: TextBackGroundColor
Specifies the background color of the header.
HeaderText String optionalposition: namedpipeline: Falsealiases: Name, Title
Specifies the header text of the section.
HeaderTextAlignment String optionalposition: namedpipeline: Falsealiases: TextAlignmentvalues: 4
Specifies the text alignment of the header. Valid values are 'center', 'left', 'right', 'justify'.
Possible values: center, left, right, justify
HeaderTextColor String optionalposition: namedpipeline: Falsealiases: TextColor
Specifies the text color of the header.
HeaderTextSize String optionalposition: namedpipeline: Falsealiases: TextSize
Specifies the text size of the header.
Height Object optionalposition: namedpipeline: False
Specifies the height of the section.
Invisible SwitchParameter optionalposition: namedpipeline: False
Indicates whether the section is invisible.
IsHidden SwitchParameter optionalposition: namedpipeline: False
Indicates whether the section is initially hidden.
JustifyContent String optionalposition: namedpipeline: Falsevalues: 3
Specifies the justify-content property. Valid values are 'flex-start', 'flex-end', 'center'.
Possible values: flex-start, flex-end, center
Margin Object optionalposition: namedpipeline: False
Specifies the margin of the section.
StyleSheetsConfiguration IDictionary optionalposition: namedpipeline: False
Specifies the configuration for style sheets.
Width Object optionalposition: namedpipeline: False
Specifies the width of the section. Default value is '100%'.
Wrap String optionalposition: namedpipeline: Falsevalues: 3
Specifies the flex-wrap property. Valid values are 'wrap', 'nowrap', 'wrap-reverse'.
Possible values: wrap, nowrap, wrap-reverse