> 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/es/comandos-de-powershell/new-udbutton.md).

# New-UDButton

New-UDButton crea un componente de botón en el que se puede hacer clic en PowerShell Universal que activa una acción, un script o la navegación a un enlace.

### Sinopsis

Los botones permiten a los usuarios realizar acciones y tomar decisiones con una sola pulsación..

### Sintaxis

```powershell
New-UDButton [[-Text] <String>] [[-Icon] <Object>] [[-Variant] <String>] [[-IconAlignment] <String>] [[-FullWidth]] [[-OnClick] <Endpoint>] [[-Size] <String>] [[-Style] <Hashtable>] [[-Href] <String>] [-Target <String>] [-Id <String>] [-Color <String>] [-Disabled] [-ClassName <String>] [-ShowLoading] [-LoadingIndicator <Object>] [-LoadingPosition <String>] [<CommonParameters>]
```

### Descripción

Crea un nuevo botón. Los botones permiten a los usuarios realizar acciones y tomar decisiones con una sola pulsación.

### Parámetros

#### -Text

El texto que se muestra dentro del botón.

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

#### -Icon

Un icono que se muestra dentro del botón. Utilice New-UDIcon para crear un icono para este parámetro.

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

#### -Variant

El tipo de variante de este botón. Los valores válidos son: "text", "outlined", "contained"

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

#### -IconAlignment

Cómo alinear el icono dentro del botón. Los valores válidos son: "left", "right"

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

#### -FullWidth

Si el botón ocupa todo el ancho de su contenedor.

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

#### -OnClick

La acción que se realiza cuando se hace clic en el botón.

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

#### -Size

El tamaño del botón. Los valores válidos son: "small", "medium", "large"

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

#### -Style

Estilos que se aplican al botón.

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

#### -Href

Una URL a la que se debe redirigir al usuario cuando hace clic en el botón.

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

#### -Target

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

#### -Id

El ID del componente. De forma predeterminada, es un GUID aleatorio.

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

#### -Color

El color del componente. Los valores válidos son: 'default', 'inherit', 'primary', 'secondary', 'info', 'warning', 'error', 'success'

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

#### -Disabled

Si el botón está deshabilitado.

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

#### -ClassName

La clase CSS que se aplica al botón.

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

#### -ShowLoading

Muestra un indicador de carga mientras se ejecuta el controlador de eventos OnClick.

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

#### -LoadingIndicator

Un elemento personalizado que se muestra en lugar del indicador de carga integrado para -ShowLoading

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

#### -LoadingPosition

La posición del indicador de carga. Los valores válidos son: 'start', 'end', 'center'

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

#### Parámetros comunes

Este cmdlet admite los parámetros comunes: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable y OutVariable. Para obtener más información, consulte [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Salidas

### Ejemplos

#### Ejemplo 1: botones básicos

```powershell
New-UDButton -Variant 'text' -Text 'Text' -Id 'button1'
New-UDButton -Variant 'contained' -Text 'Contained'  -Id 'button2'
New-UDButton -Variant 'outlined' -Text 'Outlined' -Id 'button3'
```

UDButton incluye tres variantes: text, contained y outlined.

#### Ejemplo 2: gestión de clics

```powershell
New-UDButton -Text 'Click me' -OnClick {
  Show-UDToast -Message 'Hello, world!'
} -Id 'button4'
```

PowerShell que se ejecuta cuando se hace clic en el botón.

#### Ejemplo 3: color

```powershell
New-UDButton -Text 'Secondary' -Color secondary -Id 'button5'
New-UDButton -Text 'Success' -Color success -Id 'button6'
New-UDButton -Text 'Error' -Color error -Id 'button7'
```

Ajuste el color del botón con -Color

#### Ejemplo 4: tamaños

```powershell
New-UDButton -Variant 'text' -Text 'small' -Id 'button8' -Size small
New-UDButton -Variant 'text' -Text 'medium'  -Id 'button9' -Size medium
New-UDButton -Variant 'text' -Text 'large' -Id 'button10' -Size large
New-UDButton -Variant 'contained' -Text 'small' -Id 'button11'  -Size small
New-UDButton -Variant 'contained' -Text 'medium'  -Id 'button12'  -Size medium
New-UDButton -Variant 'contained' -Text 'large' -Id 'button13'  -Size large
New-UDButton -Variant 'outlined' -Text 'small' -Id 'button14'  -Size small
New-UDButton -Variant 'outlined' -Text 'medium'  -Id 'button15'  -Size medium
New-UDButton -Variant 'outlined' -Text 'large' -Id 'button16'  -Size large
```

Para botones más grandes o más pequeños, utilice el parámetro -Size.

#### Ejemplo 5: icono

```powershell
New-UDButton -Icon (New-UDIcon -Icon 'User') -Text 'View User' -Id 'button17'
```

Mostrar un icono dentro del botón

#### Ejemplo 6: carga

```powershell
New-UDButton -OnClick { Start-Sleep 3 } -ShowLoading -Text 'Load Data' -Id 'button18'
```

Mostrar un indicador de carga mientras se ejecuta el controlador de eventos OnClick.


---

# 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/es/comandos-de-powershell/new-udbutton.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.
