> 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-udbuttongroup.md).

# New-UDButtonGroup

New-UDButtonGroup creates a container component in PowerShell Universal that groups related New-UDButtonGroupItem buttons together visually.

### Synopsis

Creates a new button group.

### Syntax

```powershell
New-UDButtonGroup [[-Id] <String>] [[-Children] <ScriptBlock>] [[-ClassName] <String>] [[-Color] <Object>] [-Disabled] [-FullWidth] [[-Orientation] <String>] [[-Size] <String>] [[-Sx] <Hashtable>] [[-Variant] <String>] [<CommonParameters>]
```

### Description

Creates a button group. Use New-UDButtonGroupItem to add new items to the group.

### 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
```

#### -Children

The items in the group.

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

#### -ClassName

A CSS class to apply to the button group.

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

#### -Color

The color of the button group. Valid values are: "primary", "secondary", "success", "warning", "error", "success", "info"

```
Required?                    false
Position?                    4
Default value                primary
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Disabled

Disables the button group.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -FullWidth

Makes the button group full width.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Orientation

The orientation of the button group. Valid values are: "horizontal", "vertical"

```
Required?                    false
Position?                    5
Default value                horizontal
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Size

The size of the button group. Valid values are: "small", "medium", "large"

```
Required?                    false
Position?                    6
Default value                medium
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Sx

An hashtable of styles to apply to this component.

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

#### -Variant

The variant of the button group. Valid values are: "contained", "outlined", "text"

```
Required?                    false
Position?                    8
Default value                outlined
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### Common parameters

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

### Examples

#### Example 1: Basic button group

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
}
```

The button group offers two items.

#### Example 2: Color

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Color 'success'
```

You can use the -Color parameter to change the color of the button group.

#### Example 3: Vertical

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Orientation 'vertical'
```

You can use the -Orientation parameter to change the orientation of the button group.

#### Example 4: Size

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Size 'small'
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Size 'medium'
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Size 'large'
```

You can use the -Size parameter to change the size of the button group.

#### Example 5: Variant

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Variant 'contained'
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Variant 'outlined'
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Variant 'text'
```

You can use the -Variant parameter to change the variant of the button group.

#### Example 6: Disabled

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -Disabled
```

You can use the -Disabled parameter to disable the button group.

#### Example 7: FullWidth

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete'
    New-UDButtonGroupItem -Text 'Copy'
} -FullWidth
```

You can use the -FullWidth parameter to make the button group full width.

#### Example 8: Icon

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete' -Icon (New-UDIcon -Icon 'trash')
    New-UDButtonGroupItem -Text 'Copy'  -Icon (New-UDIcon -Icon 'copy')
}
```

You can use the -Icon parameter to add an icon to the button group item.

#### Example 9: Loading

```powershell
New-UDButtonGroup -Content {
    New-UDButtonGroupItem -Text 'Delete' -Icon (New-UDIcon -Icon 'trash') -ShowLoading -OnClick {
       Start-Sleep -Seconds 5
    }
    New-UDButtonGroupItem -Text 'Copy'  -Icon (New-UDIcon -Icon 'copy')
}
```

You can use the -ShowLoading parameter to show a loading spinner when the button is clicked.


---

# 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-udbuttongroup.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.
