> 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/powershell-commands/new-udlist.md).

# New-UDList

### Synopsis

Lists are continuous, vertical indexes of text or images.

### Syntax

```powershell
New-UDList [[-Id] <String>] [[-Children] <ScriptBlock>] [[-SubHeader] <String>] [[-ClassName] <String>] [-Dense] [[-Sx] <Hashtable>] [[-AlignItems] <String>] [<CommonParameters>]
```

### Description

Creates a list. Use New-UDListItem to add new items to the list. Lists are good for links in UDDrawers.

### Parameters

#### -Id

The ID of the component. It defaults to a random GUID.

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

#### -Children

The items in the list.

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

#### -SubHeader

Text to show within the sub header.

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

#### -ClassName

A CSS class to apply to the list.

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

    -Dense [<SwitchParameter>]
        Whether the list is dense.

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

#### -Sx

An hashtable of styles to apply to this component.

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

#### -AlignItems

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

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
```

### Outputs

\-------------------------- EXAMPLE 1 --------------------------

```
PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff'
PS >    New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on "
PS >    New-UDListItem -Label 'Trash' -Icon (New-UDIcon -Icon trash -Size 3x) -SubTitle 'Stuff I deleted'
PS >    New-UDListItem -Label 'Spam' -Icon (New-UDIcon -Icon bug -Size 3x) -SubTitle "Stuff I didn't want"
PS > } -Id 'list1'

Basic list|A basic list of items with icons and a subtitle.




-------------------------- EXAMPLE 2 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox'
PS >    New-UDListItem -Label 'Drafts'
PS >    New-UDListItem -Label 'Trash'
PS >    New-UDListItem -Label 'Spam'
PS > } -Id 'list2' -Dense

Dense list|A dense list.




-------------------------- EXAMPLE 3 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff' -OnClick {
PS >        Show-UDToast -Message 'Inbox Clicked'
PS >    }
PS >    New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on " -OnClick {
PS >        Show-UDToast -Message 'Drafts Clicked'
PS >    }
PS > } -Id 'list3'

OnClick|Respond to clicks on list items.




-------------------------- EXAMPLE 4 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff' -SecondaryAction {
PS >        New-UDButton -Text 'Secondary Action'
PS >    }
PS >    New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on " -SecondaryAction {
PS >        New-UDButton -Text 'Secondary Action'
PS >    }
PS > } -Id 'list4'

Secondary Action|Respond to secondary actions on list items.




-------------------------- EXAMPLE 5 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff' -Children {
PS >        New-UDListItem -Label 'Inbox Item 1' -Nested
PS >        New-UDListItem -Label 'Inbox Item 2' -Nested
PS >        New-UDListItem -Label 'Inbox Item 3' -Nested
PS >    }
PS >    New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on " -Children {
PS >        New-UDListItem -Label 'Drafts Item 1' -Nested
PS >        New-UDListItem -Label 'Drafts Item 2' -Nested
PS >        New-UDListItem -Label 'Drafts Item 3' -Nested
PS >    }
PS > } -Id 'list5'

Nested List Items|Create nested list items.




-------------------------- EXAMPLE 6 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -Icon (New-UDIcon -Icon envelope -Size 3x) -SubTitle 'New Stuff' -Switch (New-UDSwitch) -SwitchAlignment 'right'
PS >    New-UDListItem -Label 'Drafts' -Icon (New-UDIcon -Icon edit -Size 3x) -SubTitle "Stuff I'm working on " -Switch (New-UDSwitch) -SwitchAlignment 'right'
PS >    New-UDListItem -Label 'Trash' -Icon (New-UDIcon -Icon trash -Size 3x) -SubTitle 'Stuff I deleted' -Switch (New-UDSwitch) -SwitchAlignment 'right'
PS >    New-UDListItem -Label 'Spam' -Icon (New-UDIcon -Icon bug -Size 3x) -SubTitle "Stuff I didn't want" -Switch (New-UDSwitch) -SwitchAlignment 'right'
PS > } -Id 'list6'

Switch|Create a list item with a switch.




-------------------------- EXAMPLE 7 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -SubTitle 'New Stuff' -CheckBox (New-UDCheckbox) -CheckBoxAlignment 'left'
PS >    New-UDListItem -Label 'Drafts' -SubTitle "Stuff I'm working on " -CheckBox (New-UDCheckbox) -CheckBoxAlignment 'left'
PS >    New-UDListItem -Label 'Trash' -SubTitle 'Stuff I deleted' -CheckBox (New-UDCheckbox) -CheckBoxAlignment 'left'
PS >    New-UDListItem -Label 'Spam' -SubTitle "Stuff I didn't want" -CheckBox (New-UDCheckbox) -CheckBoxAlignment 'left'
PS > } -Id 'list7'

CheckBox|Create a list item with a checkbox.




-------------------------- EXAMPLE 8 --------------------------

PS >New-UDList -Content {
PS >    New-UDListItem -Label 'Inbox' -SubTitle 'New Stuff' -Href 'https://ironmansoftware.com' -OpenInNewWindow
PS >    New-UDListItem -Label 'Drafts' -SubTitle "Stuff I'm working on " -Href 'https://powershellgallery.com' -OpenInNewWindow
PS >    New-UDListItem -Label 'Trash' -SubTitle 'Stuff I deleted' -Href 'https://github.com/powershell/powershell' -OpenInNewWindow
PS >    New-UDListItem -Label 'Spam' -SubTitle "Stuff I didn't want"
PS > } -Id 'list7'

Links|Create a list item with links
```


---

# 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/powershell-commands/new-udlist.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.
