> 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/aplicaciones/components/inputs/button.md).

# Botón

Los botones permiten a los usuarios realizar acciones y tomar decisiones con un solo toque.

## Botón contained

![](/files/3OjzBAxZimBsOWK2zeIG)

Los botones contained tienen un énfasis alto y se distinguen por su uso de la elevación y el relleno. Contienen acciones que son principales en su aplicación.

```powershell
 New-UDButton -Variant 'contained' -Text 'Default'
```

## Botón outlined

![](/files/jM8jMT6qAZRo58umUdK8)

Los botones outlined son botones de énfasis medio. Contienen acciones importantes, pero que no son la acción principal de una aplicación.

```powershell
New-UDButton -Variant 'outlined' -Text 'Default'
```

## Controlar el tamaño del botón

Puede controlar el tamaño en píxeles de un botón mediante el parámetro Style

```powershell
New-UDButton -Id "Submit" -Text "Submit" -Style @{ Width = "150px"; Height = "100px" }
```

## Botones con iconos y etiqueta

![](/files/aR0ez1psvYQ2HzQbHR8P)

En ocasiones puede querer tener iconos en determinados botones para mejorar la experiencia de usuario de la aplicación, ya que reconocemos los logotipos más fácilmente que el texto sin formato. Por ejemplo, si tiene un botón de eliminación, puede etiquetarlo con un icono de papelera.

```powershell
New-UDButton -Icon (New-UDIcon -Icon trash) -Text 'Delete'
```

## Botones con controladores de eventos

Puede especificar un bloque de script para que se ejecute cuando se haga clic en el botón

```powershell
New-UDButton -Text 'Message Box' -OnClick {
    Show-UDToast -Message 'Hello, world!'
}
```

## Botón de carga

![](/files/MrGEVcV5FTYOtczvJXID)

Los botones de carga muestran un icono de carga mientras se ejecuta un controlador de eventos. Esto resulta útil para eventos de mayor duración.

```powershell
New-UDButton -Text 'Message Box' -OnClick {
    Show-UDToast -Message 'Hello, world!'
    Start-Sleep 10
} -ShowLoading
```

## Grupo de botones

Un grupo de botones genera un botón con un menú desplegable. También se denomina botón dividido.

```powershell
New-UDButtonGroup -Children {
    New-UDButtonGroupItem -Text "Button 1" -OnClick {
        Show-UDToast "Button 1"
    }
    New-UDButtonGroupItem -Text "Button 2" -OnClick {
        Show-UDToast "Button 2"
    }
    New-UDButtonGroupItem -Text "Button 3" -OnClick {
        Show-UDToast "Button 3"
    }
}
```

<figure><img src="/files/XMoqZIb5QSkTgXGwDpeO" alt=""><figcaption><p>Grupo de botones</p></figcaption></figure>

## Desactivar el botón después de hacer clic

Este ejemplo utiliza `Set-UDElement` para desactivar el botón después de realizar una acción.

```powershell
New-UDButton -Id "btn1" -OnClick {
    Show-UDToast "Hello!"
    Set-UDElement -Id 'btn1' -Attributes @{
        disabled = $true
    }
}
```

## API

* [New-UDButton](/powershell-universal/es/comandos-de-powershell/new-udbutton.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/es/aplicaciones/components/inputs/button.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.
