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

# New-UDCheckBox

New-UDCheckBox creates a checkbox control in PowerShell Universal for capturing boolean input, usable standalone or inside New-UDForm.

### Synopsis

Creates a checkbox.

### Syntax

```powershell
New-UDCheckBox [[-Label] <String>] [[-Icon] <Object>] [[-CheckedIcon] <Object>] [[-OnChange] <Endpoint>] [[-Style] <Hashtable>] [[-Disabled]] [[-Checked] <Boolean>] [[-ClassName] <String>] [[-LabelPlacement] <String>] [[-Id] <String>] [[-Size] <String>] [-Color <String>] [-Indeterminate] [<CommonParameters>]
```

### Description

Creates a checkbox. Checkboxes can be used in forms or by themselves.

### Parameters

#### -Label

The label to show next to the checkbox.

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

#### -Icon

The icon to show instead of the default icon. Use New-UDIcon to create an icon.

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

#### -CheckedIcon

The icon to show instead of the default checked icon. Use New-UDIcon to create an icon.

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

#### -OnChange

Called when the value of the checkbox changes. The $EventData variable will have the current value of the checkbox.

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

#### -Style

A hashtable of styles to apply to the checkbox.

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

#### -Disabled

Whether the checkbox is disabled.

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

#### -Checked

Whether the checkbox is checked.

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

#### -ClassName

A CSS class to assign to the checkbox.

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

#### -LabelPlacement

Where to place the label. Valid values are: "top","start","bottom","end"

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

#### -Id

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

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

#### -Size

The size of the checkbox. Valid values are: "small", "medium"

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

#### -Color

The theme color to apply to this component

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

#### -Indeterminate

Whether the checkbox is in an indeterminate state. This is a visual state only and does not affect the value of the checkbox.

```
Required?                    false
Position?                    named
Default value                False
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 checkbox

```powershell
New-UDCheckbox -Label 'Demo' -Id 'checkbox1'
```

A basic checkbox.

#### Example 2: Disabled checkbox

```powershell
New-UDCheckbox -Label 'Demo' -Disabled -Id 'checkbox2'
```

A disabled checkbox.

#### Example 3: Checked checkbox

```powershell
New-UDCheckbox -Label 'Demo' -Checked $true -Id 'checkbox3'
```

A checked checkbox.

#### Example 4: Checkbox with custom icons

```powershell
New-UDCheckbox -Label 'Demo' -Icon (New-UDIcon -Icon 'user') -CheckedIcon (New-UDIcon -Icon 'check') -Id 'checkbox4'
```

A checkbox with custom icons.

#### Example 5: Checkbox with OnChange

```powershell
New-UDCheckbox -Label 'Demo' -OnChange {
    Show-UDToast -Title 'Checkbox' -Message $Body
} -Id 'checkbox5'
```

A checkbox with an OnChange event.

#### Example 6: Checkbox with label on top

```powershell
New-UDCheckbox -Label 'Demo' -LabelPlacement 'top' -Id 'checkbox6'
```

A checkbox with the label on top.

#### Example 7: Checkbox with secondary color

```powershell
New-UDCheckbox -Label 'Demo' -Color 'secondary' -Id 'checkbox7'
```

A checkbox with the secondary color.

#### Example 8: Checkbox in indeterminate state

```powershell
New-UDCheckbox -Label 'Demo' -Id 'checkbox8' -Indeterminate
```

A checkbox in an indeterminate state.


---

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