> 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/utilities/dynamic-regions.md).

# Regiones dinámicas

`New-UDDynamic` permite definir una región dinámica. Las páginas en sí mismas son dinámicas por naturaleza. Esto significa que cada vez que se carga una página, se ejecuta el PowerShell de esa página. En ocasiones, puede que desee recargar una sección de una página en lugar de la página completa. Es entonces cuando querrá usar regiones dinámicas.

## Región dinámica básica

Esta región dinámica se recarga cuando se hace clic en el botón.

```powershell
New-UDApp -Title "Hello, World!" -Content {
    New-UDDynamic -Id 'date' -Content {
        New-UDTypography -Text "$(Get-Date)"
    }

    New-UDButton -Text 'Reload Date' -OnClick { Sync-UDElement -Id 'date' }
}
```

![Reload on button click](/files/RsT2M0Qdih0JEOVvERDz)

## Lista de argumentos

Se puede pasar una matriz de argumentos a la región dinámica.

```powershell
New-UDDynamic -Id 'dynamic_01' -Content {
    New-UDTypography -Text "This is an $($ArgumentList[0]) an $($ArgumentList[1]) in a UDDynamic"
} -ArgumentList @('example of', 'arguments list') 
```

<figure><img src="/files/XLWBJO6dcyEivfGFqGy1" alt=""><figcaption><p>utilizando la lista de argumentos</p></figcaption></figure>

Puede usar `Sync-UDElement` para cambiar los valores de los argumentos.

```powershell
 New-UDDynamic -id DynamicRegion -ArgumentList 5,'hello' -content {
  foreach($item in $argumentList){
      New-UDTypography -Variant h3 -Text "Item: $item"
  }
 }

 New-UDButton -Text "Sync Dynamic" -onclick {
  Sync-UDElement -id DynamicRegion -ArgumentList 10,'World'
 }
```

## Actualización automática

Las regiones dinámicas permiten actualizar automáticamente los componentes después de un tiempo determinado. Todo el bloque de script de la región se ejecutará al actualizarse automáticamente.

{% hint style="info" %}
Si tiene varios componentes relacionados que usan los mismos datos, considere colocarlos en la misma región dinámica para mejorar el rendimiento.
{% endhint %}

```powershell
    New-UDDynamic -Id 'date' -Content {
        New-UDTypography -Text "$(Get-Date)" -Variant h3
        New-UDTypography -Text "$(Get-Random)" -Variant h3
    } -AutoRefresh -AutoRefreshInterval 1
```

![Auto refresh dynamic region](/files/vQsAxFvJFXwK9KOFBk9S)

## Componente de carga

A veces, actualizar un componente dinámico puede llevar cierto tiempo. Por ejemplo, si está consultando la API REST de otro servicio o unos datos. Las regiones dinámicas admiten la configuración del componente que se muestra cuando la región se está recargando. Por defecto, no se muestra nada. Puede ser cualquier componente de aplicación.

```powershell
    New-UDDynamic -Content {
        Start-Sleep -Seconds 3
        New-UDTypography -Text "Done!"
    } -LoadingComponent {
        New-UDProgress -Circular
    }
```

![Loading component for dynamic region](/files/Gs2pmCvipSN8AYYPic20)

## API

[New-UDDynamic](/powershell-universal/es/comandos-de-powershell/new-uddynamic.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/utilities/dynamic-regions.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.
