> 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/it/app/components/inputs/checkbox.md).

# Casella di controllo

Le caselle di controllo consentono all'utente di selezionare uno o più elementi da un insieme.

## Caselle di controllo

![](/files/R8pc8Q09SBf9DEgB5zTx)

Le caselle di controllo possono essere disabilitate e selezionate per impostazione predefinita

```powershell
New-UDCheckBox
New-UDCheckBox -Disabled
New-UDCheckBox -Checked $true
New-UDCheckBox -Checked $true -Disabled
```

## Caselle di controllo con icona personalizzata

![](/files/VhIur8xBNNJzGrPxAjCW)

Crei caselle di controllo che utilizzano qualsiasi icona e stile.

```powershell
$Icon = New-UDIcon -Icon angry -Size lg -Regular
$CheckedIcon = New-UDIcon -Icon angry -Size lg
New-UDCheckBox -Icon $Icon -CheckedIcon $CheckedIcon -Style @{color = '#2196f3'}
```

## Caselle di controllo con blocco di script onChange

Crei caselle di controllo che eseguono blocchi di script quando vengono modificate.

```powershell
New-UDCheckBox -OnChange {
    Show-UDToast -Title 'Checkbox' -Message $Body
}
```

## Casella di controllo con posizionamento personalizzato dell'etichetta

![](/files/GaGhfoqMGH2ae9VeOygY)

È possibile regolare la posizione in cui viene collocata l'etichetta della casella di controllo.

```powershell
New-UDCheckBox -Label 'Demo' -LabelPlacement start
New-UDCheckBox -Label 'Demo' -LabelPlacement top
New-UDCheckBox -Label 'Demo' -LabelPlacement bottom
New-UDCheckBox -Label 'Demo' -LabelPlacement end
```

## Ottenere il valore di una casella di controllo

È possibile utilizzare `Get-UDElement` per ottenere il valore della casella di controllo. `Get-UDElement` restituirà anche altre proprietà del componente casella di controllo.

L'esempio seguente mostra un messaggio toast con il valore della casella di controllo.

```powershell
New-UDCheckbox -Id 'MyCheckbox' 

New-UDButton -Text 'Get Value' -OnClick {
    Show-UDToast -Message (Get-UDElement -Id 'MyCheckbox').checked
}
```

## API

* [New-UDCheckbox](/powershell-universal/it/comandi-powershell/new-udcheckbox.md)


---

# 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/it/app/components/inputs/checkbox.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.
