> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/powershell-commands/new-udiconbutton.md).

# New-UDIconButton

### Synopsis

Creates a button with an icon.

### Syntax

```powershell
New-UDIconButton [[-Id] <String>] [[-Icon] <Object>] [[-OnClick] <Endpoint>] [-Disabled] [[-Href] <String>] [[-Style] <Hashtable>] [[-ClassName] <String>] [[-Size] <String>] [[-Variant] <String>] [-ShowLoading] [[-LoadingComponent] <ScriptBlock>] [<CommonParameters>]
```

### Description

Creates a button with an icon.

### Parameters

#### -Id

The ID of the component. It defaults to a random GUID.

```
Required?                    false
Position?                    1
Default value                ([Guid]::NewGuid()).ToString()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Icon The icon to display within the button.Required?                    falsePosition?                    2Default value                UserAccept pipeline input?       falseAliasesAccept wildcard characters?  false-OnClickA script block to execute when the button is clicked.Required?                    falsePosition?                    3Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -Disabled \[\<SwitchParameter>]        Whether the button is disabled.Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false-HrefA link to navigate to when the button is clicked.Required?                    falsePosition?                    4Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-StyleThe CSS sytle to apply to the icon.Required?                    falsePosition?                    5Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-ClassNameA CSS class to apply to the icon.Required?                    falsePosition?                    6Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-SizeThe size of the icon button. Valid values are: "small", "medium", "large"Required?                    falsePosition?                    7Default value                mediumAccept pipeline input?       falseAliasesAccept wildcard characters?  false-VariantRequired?                    falsePosition?                    8Default value                textAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -ShowLoading \[\<SwitchParameter>]Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false-LoadingComponentRequired?                    falsePosition?                    9Default valueAccept 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-UDIconButton -Icon (New-UDIcon -Icon user -Size sm)  -Id 'iconButton1'Basic Icon Button|Creates a basic icon button.-------------------------- EXAMPLE 2 --------------------------PS >New-UDIconButton -Icon (New-UDIcon -Icon user -Size sm) -OnClick {PS >    Show-UDToast -Message 'Icon Button Clicked'PS > } -Id 'iconButton2'Icon Button with OnClick|Creates an icon button with an OnClick script block.-------------------------- EXAMPLE 3 --------------------------PS >New-UDIconButton -Icon (New-UDIcon -Icon user -Size sm) -Href '<https://www.google.com>' -Id 'iconButton3'Icon Button with Href|Creates an icon button that navigates to a URL.-------------------------- EXAMPLE 4 --------------------------PS >New-UDIconButton -Icon (New-UDIcon -Icon user -Size sm) -Disabled -Id 'iconButton4'Disabled Icon Button|Creates a disabled icon button.-------------------------- EXAMPLE 5 --------------------------PS >New-UDIconButton -Icon (New-UDIcon -Icon user -Size sm) -Id 'iconButton5' -OnClick {PS >    Show-UDToast -Message 'Icon Button Clicked'PS >    Start-Sleep -Seconds 5PS > } -ShowLoadingIcon Button with Loading|Creates an icon button with a loading spinner.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/powershell-commands/new-udiconbutton.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
