# Examples

## Display Processes

This example displays processes in a table.&#x20;

```powershell
New-UDDashboard -Title 'Processes' -Content {
    $Processes = Get-Process | Select-Object Id, Name
    New-UDTable -Columns @(
        New-UDTableColumn -Property 'Id' -Title 'Id'
        New-UDTableColumn -Property 'Name' -Title 'Name'
    ) -Data $Processes -ShowPagination
}
```

<figure><img src="/files/NJ5xNgJEzlVKUUAE5avC" alt=""><figcaption></figcaption></figure>

## File System Browser

Create a file system browser with a dynamic tree view.&#x20;

```powershell
New-UDDashboard -Title 'Processes' -Content {
    Get-PSDrive -PSProvider 'FileSystem' | ForEach-Object {
        New-UDTreeView -Node { New-UDTreeNode -Name $_.Name -Id "$($_.Name):\" } -OnNodeClicked {
            Get-ChildItem $EventData.Id | ForEach-Object {
                New-UDTreeNode -Name $_.Name -Id $_.FullName -Leaf:$(-not $_.PSIsContainer)
            }
        }
    }
}
```

<figure><img src="/files/6PPh4Br1R2U5APoleuYt" alt=""><figcaption></figcaption></figure>

## Create User Form

This example shows how to create a local user account.&#x20;

```powershell
New-UDDashboard -Title 'New User' -Content {
    New-UDForm -Content {
        New-UDTextbox -Id 'UserName' -Label "User Name"
        New-UDTextbox -Id 'Password' -Label 'Password' -Type 'password'
    } -OnSubmit {
        $Password = $EventData.Password | ConvertTo-SecureString -AsPlainText
        New-LocalUser -Name $EventData.UserName -Password $Password
        Show-UDToast "New user $($EventData.UserName) was created!"
    }
}
```

<figure><img src="/files/Ab8eDFIrrVqx84ngUduv" alt=""><figcaption></figcaption></figure>

## Clock

This example shows how to create a clock component in PowerShell Universal Dashboard.

```powershell
New-UDDashboard -Title 'Clock' -Content {
    New-UDDynamic -Id 'clock' -Content {
        (Get-Date).ToString('T')
    } -AutoRefresh -AutoRefreshInterval 1
    
    New-UDButton -Text 'Toggle Clock' -OnClick {
        Set-UDElement -Id 'clock' -Properties @{
            autoRefresh = -not( (Get-UDElement -Id 'clock').AutoRefresh)
        }
    }
}
```

<figure><img src="/files/ypm1JV14v4l5KYi5MLzy" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://docs.powershelluniversal.com/v3/userinterfaces/dashboards/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
