> 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/it/comandi-powershell/new-udtextbox.md).

# New-UDTextbox

New-UDTextbox crea un campo di input di testo in PowerShell Universal per inserire e modificare valori, utilizzabile autonomamente o all'interno di un modulo.

### Sinossi

Le caselle di testo consentono agli utenti di inserire e modificare testo.

### Sintassi

```powershell
New-UDTextbox [[-Id] <String>] [[-Label] <String>] [[-Placeholder] <String>] [[-Value] <String>] [[-Type] <String>] [-Disabled] [[-Icon] <Object>] [-Autofocus] [-Multiline] [[-Rows] <Int32>] [[-RowsMax] <Int32>] [-FullWidth] [[-Variant] <String>] [[-ClassName] <String>] [[-OnEnter] <Endpoint>] [[-OnBlur] <Endpoint>] [-Shrink] [[-OnValidate] <Endpoint>] [[-HelperText] <String>] [[-OnChange] <Endpoint>] [[-Minimum] <Int32>] [[-Maximum] <Int32>] [[-MaximumLength] <Int32>] [[-Sx] <Hashtable>] [[-Style] <Hashtable>] [[-MaskPattern] <String>] [[-Attributes] <Hashtable>] [<CommonParameters>]
```

### Descrizione

Crea una casella di testo. Le caselle di testo possono essere utilizzate da sole o all'interno di un New-UDForm.

### Parametri

#### -Id

L'ID del componente. Per impostazione predefinita è un GUID casuale.

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

#### -Label

Un'etichetta da mostrare sopra questa casella di testo.

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

#### -Placeholder

Un segnaposto da inserire all'interno della casella di testo.

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

#### -Value

Il valore corrente della casella di testo.

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

#### -Type

Il tipo di casella di testo. Può assumere valori come text, password o email.

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

#### -Disabled

Indica se questa casella di testo è disabilitata.

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

#### -Icon

L'icona da mostrare accanto alla casella di testo. Utilizzi New-UDIcon per creare un'icona.

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

#### -Autofocus

Indica se applicare l'autofocus a questa casella di testo.

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

#### -Multiline

Crea una casella di testo multiriga

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

#### -Rows

Il numero di righe in una casella di testo multiriga.

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

#### -RowsMax

Il numero massimo di righe in una casella di testo multiriga.

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

#### -FullWidth

Indica se questa casella di testo deve occupare l'intera larghezza del controllo padre.

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

#### -Variant

La variante della casella di testo. I valori validi sono "filled", "outlined", "standard"

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

#### -ClassName

Una classe CSS da applicare alla casella di testo.

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

#### -OnEnter

Un blocco di script che viene chiamato quando l'utente preme il tasto Invio. La variabile $EventData conterrà il valore corrente della casella di testo.

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

#### -OnBlur

Un blocco di script che viene chiamato quando l'utente esce dalla casella di testo. La variabile $EventData conterrà il valore corrente della casella di testo.

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

#### -Shrink

Indica se ridurre l'etichetta per impostazione predefinita.

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

#### -OnValidate

Un blocco di script che viene chiamato quando l'utente esce dalla casella di testo. La variabile $EventData conterrà il valore corrente della casella di testo. Se il blocco di script restituisce un risultato di convalida non valido, questo verrà visualizzato sotto la casella di testo.

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

#### -HelperText

Un testo di aiuto da mostrare sotto la casella di testo.

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

#### -OnChange

Un blocco di script che viene chiamato quando l'utente modifica il valore della casella di testo. La variabile $EventData conterrà il valore corrente della casella di testo.

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

#### -Minimum

Il valore minimo per una casella di testo numerica.

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

#### -Maximum

Il valore massimo per una casella di testo numerica.

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

#### -MaximumLength

La lunghezza massima del testo nella casella di testo.

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

#### -Sx

Una hashtable di proprietà basate sul tema da applicare alla casella di testo.

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

#### -Style

Una hashtable di proprietà CSS da applicare alla casella di testo.

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

#### -MaskPattern

Un modello di maschera da applicare alla casella di testo. Viene utilizzato per le maschere di input. Consulti iMaskjs per maggiori informazioni.

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

#### -Attributes

```
Required?                    false
Position?                    22
Default value                @{}
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### Parametri comuni

Questo cmdlet supporta i parametri comuni: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable e OutVariable. Per maggiori informazioni, veda [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Output

### Esempi

#### Esempio 1: casella di testo di base

```powershell
New-UDTextbox -Id 'textbox1' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo di base.

#### Esempio 2: casella di testo per password

```powershell
New-UDTextbox -Id 'textbox2' -Label 'Password' -Placeholder 'Enter your password' -Type 'password'
```

Crea una casella di testo per password.

#### Esempio 3: casella di testo per email

```powershell
New-UDTextbox -Id 'textbox3' -Label 'Email' -Placeholder 'Enter your email' -Type 'email'
```

Crea una casella di testo per email.

#### Esempio 4: casella di testo disabilitata

```powershell
New-UDTextbox -Id 'textbox4' -Disabled -Label 'Disabled' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo disabilitata.

#### Esempio 5: casella di testo con icona

```powershell
New-UDTextbox -Id 'textbox5' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe' -Icon (New-UDIcon -Icon 'User')
```

Crea una casella di testo con un'icona.

#### Esempio 6: casella di testo con autofocus

```powershell
New-UDTextbox -Id 'textbox6' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe' -Autofocus
```

Crea una casella di testo che riceverà l'autofocus al caricamento della pagina.

#### Esempio 7: casella di testo multiriga

```powershell
New-UDTextbox -Id 'textbox7' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe' -Multiline
```

Crea una casella di testo multiriga.

#### Esempio 8: casella di testo multiriga con 5 righe

```powershell
New-UDTextbox -Id 'textbox8' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe' -Multiline -Rows 5 -RowsMax 10
```

Crea una casella di testo multiriga con 5 righe.

#### Esempio 9: variante

```powershell
New-UDTextbox -Id 'textbox9' -Variant 'filled' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo filled.

#### Esempio 10: OnEnter

```powershell
New-UDTextbox -Id 'textbox10' -OnEnter {
   Show-UDToast -Message "You pressed enter!"
} -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo con un evento OnEnter.

#### Esempio 11: OnBlur

```powershell
New-UDTextbox -Id 'textbox11' -OnBlur {
   Show-UDToast -Message "You left the textbox!"
} -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo con un evento OnBlur.

#### Esempio 12: OnValidate

```powershell
New-UDTextbox -Id 'textbox12' -OnValidate {
   if ($EventData -eq 'John Doe') {
       return New-UDValidationResult -Valid
   }
   else {
       return New-UDValidationResult -ValidationError "You must enter John Doe"
   }
} -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo con un evento OnValidate.

#### Esempio 13: testo di aiuto

```powershell
New-UDTextbox -Id 'textbox13' -HelperText 'This is a helper text' -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo con testo di aiuto.

#### Esempio 14: OnChange

```powershell
New-UDTextbox -Id 'textbox14' -OnChange {
   Show-UDToast -Message $EventData
} -Label 'Name' -Placeholder 'Enter your name' -Value 'John Doe'
```

Crea una casella di testo con un evento OnChange.

#### Esempio 15: minimo e massimo

```powershell
New-UDTextbox -Id 'textbox15' -Type 'number' -Minimum 1 -Maximum 100
```

Crea una casella di testo numerica con un valore minimo e massimo.

#### Esempio 16: modello di maschera

```powershell
New-UDTextbox -Id 'textbox16' -MaskPattern '+7 (000) 000-00-00'
```

Crea una casella di testo con un modello di maschera.


---

# 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/it/comandi-powershell/new-udtextbox.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.
