For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-UDButton

Buttons allow users to take actions, and make choices, with a single tap..

Synopsis

Buttons allow users to take actions, and make choices, with a single tap..

Syntax

New-UDButton [[-Text] <String>] [[-Icon] <Object>] [[-Variant] <String>] [[-IconAlignment] <String>] [[-FullWidth]] [[-OnClick] <Endpoint>] [[-Size] <String>] [[-Style] <Hashtable>] [[-Href] <String>] [-Target <String>] [-Id <String>] [-Color <String>] [-Disabled] [-ClassName <String>] [-ShowLoading] [-LoadingIndicator <Object>] [-LoadingPosition <String>] [<CommonParameters>]

Description

Creates a new button. Buttons allow users to take actions, and make choices, with a single tap.

Parameters

-Text

The text to show within the button.

Required?                    false
Position?                    1
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

-Icon An icon to show within the button. Use New-UDIcon to create an icon for this parameter.Required? falsePosition? 2Default valueAccept pipeline input? falseAliasesAccept wildcard characters? false-VariantThe variant type for this button. Valid values are: "text", "outlined", "contained"Required? falsePosition? 3Default value containedAccept pipeline input? falseAliasesAccept wildcard characters? false-IconAlignmentHow to align the icon within the button. Valid values are: "left", "right"Required? falsePosition? 4Default value leftAccept pipeline input? falseAliasesAccept wildcard characters? false -FullWidth [<SwitchParameter>] Whether the button takes the full width of the it's container.Required? falsePosition? 7Default value FalseAccept pipeline input? falseAliasesAccept wildcard characters? false-OnClickThe action to take when the button is clicked.Required? falsePosition? 8Default valueAccept pipeline input? falseAliasesAccept wildcard characters? false-SizeThe size of the button. Valid values are: "small", "medium", "large"Required? falsePosition? 9Default valueAccept pipeline input? falseAliasesAccept wildcard characters? false-StyleStyles to apply to the button.Required? falsePosition? 10Default valueAccept pipeline input? falseAliasesAccept wildcard characters? false-HrefA URL that the user should be redirected to when clicking the button.Required? falsePosition? 11Default valueAccept pipeline input? falseAliasesAccept wildcard characters? false-TargetRequired? falsePosition? namedDefault valueAccept pipeline input? falseAliasesAccept wildcard characters? false-IdThe ID of the component. It defaults to a random GUID.Required? falsePosition? namedDefault value ([Guid]::NewGuid()).ToString()Accept pipeline input? falseAliasesAccept wildcard characters? false-ColorThe color of the component. Valid values are: 'default', 'inherit', 'primary', 'secondary', 'info', 'warning', 'error', 'success'Required? falsePosition? namedDefault value primaryAccept pipeline input? falseAliasesAccept wildcard characters? false -Disabled [<SwitchParameter>] Whether the button is disabled.Required? falsePosition? namedDefault value FalseAccept pipeline input? falseAliasesAccept wildcard characters? false-ClassNameThe CSS Class to apply to the button.Required? falsePosition? namedDefault valueAccept pipeline input? falseAliasesAccept wildcard characters? false -ShowLoading [<SwitchParameter>] Displays a loading spinner while the OnClick event handler is running.Required? falsePosition? namedDefault value FalseAccept pipeline input? falseAliasesAccept wildcard characters? false-LoadingIndicator A custom element to display instead of the built in spinner for -ShowLoadingRequired? falsePosition? namedDefault valueAccept pipeline input? falseAliasesAccept wildcard characters? false-LoadingPositionThe position of the loading indicator. Valid values are: 'start', 'end', 'center'Required? falsePosition? namedDefault value centerAccept pipeline input? falseAliasesAccept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).Outputs-------------------------- EXAMPLE 1 --------------------------PS >New-UDButton -Variant 'text' -Text 'Text' -Id 'button1'PS > New-UDButton -Variant 'contained' -Text 'Contained' -Id 'button2'PS > New-UDButton -Variant 'outlined' -Text 'Outlined' -Id 'button3'Basic buttons|UDButton comes with three variants: text, contained, and outlined.-------------------------- EXAMPLE 2 --------------------------PS >New-UDButton -Text 'Click me' -OnClick {PS > Show-UDToast -Message 'Hello, world!'PS > } -Id 'button4'Handling clicks|PowerShell that is executed when the button is clicked.-------------------------- EXAMPLE 3 --------------------------PS >New-UDButton -Text 'Secondary' -Color secondary -Id 'button5'PS > New-UDButton -Text 'Success' -Color success -Id 'button6'PS > New-UDButton -Text 'Error' -Color error -Id 'button7'Color|Adjust the button color with -Color-------------------------- EXAMPLE 4 --------------------------PS >New-UDButton -Variant 'text' -Text 'small' -Id 'button8' -Size smallPS > New-UDButton -Variant 'text' -Text 'medium' -Id 'button9' -Size mediumPS > New-UDButton -Variant 'text' -Text 'large' -Id 'button10' -Size largePS > New-UDButton -Variant 'contained' -Text 'small' -Id 'button11' -Size smallPS > New-UDButton -Variant 'contained' -Text 'medium' -Id 'button12' -Size mediumPS > New-UDButton -Variant 'contained' -Text 'large' -Id 'button13' -Size largePS > New-UDButton -Variant 'outlined' -Text 'small' -Id 'button14' -Size smallPS > New-UDButton -Variant 'outlined' -Text 'medium' -Id 'button15' -Size mediumPS > New-UDButton -Variant 'outlined' -Text 'large' -Id 'button16' -Size largeSizes|For larger or smaller buttons, use the -Size parameter.-------------------------- EXAMPLE 5 --------------------------PS >New-UDButton -Icon (New-UDIcon -Icon 'User') -Text 'View User' -Id 'button17'Icon|Display an icon within the button-------------------------- EXAMPLE 6 --------------------------PS >New-UDButton -OnClick { Start-Sleep 3 } -ShowLoading -Text 'Load Data' -Id 'button18'Loading|Show a loading indicator while the OnClick event handler is running.

Last updated

Was this helpful?