> 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/de/apps/components/inputs/switch.md).

# Switch

Umschalter schalten den Zustand einer einzelnen Einstellung ein oder aus.

Umschalter sind die bevorzugte Methode, um Einstellungen auf Mobilgeräten anzupassen. Die Option, die der Umschalter steuert, sowie der Zustand, in dem er sich befindet, sollten aus der entsprechenden Inline-Beschriftung klar hervorgehen.

## Umschalter

Erstellen Sie einen einfachen Umschalter.

![](/files/N98cM72DXf49B3GwNzX0)

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

## OnChange-Event

Reagieren Sie darauf, wenn ein Umschalterwert geändert wird. Die Variable `$EventData` enthält, ob der Umschalter aktiviert oder deaktiviert wurde.

```powershell
New-UDSwitch -OnChange { Show-UDToast -Message $EventData }
```

## Get-UDElement-Unterstützung

Sie können den Wert des Umschalters innerhalb einer anderen Komponente mit `Get-UDElement` abrufen. Verwenden Sie die Eigenschaft Checked, um festzustellen, ob der Umschalter aktiviert ist oder nicht.

```powershell
New-UDSwitch -Id 'switch' 
New-UDButton -Text 'Click' -OnClick {
    Show-UDToast -Message (Get-UDElement -Id 'switch').checked
}
```

## API

* [New-UDSwitch](/powershell-universal/de/powershell-befehle/new-udswitch.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/de/apps/components/inputs/switch.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.
