Skip to content

Commit

Permalink
Add param to autofocus textbox on load. #564
Browse files Browse the repository at this point in the history
Optimally the attribute should have no value.
  • Loading branch information
BoSen29 authored Aug 23, 2019
1 parent c29439c commit 6749fbc
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/UniversalDashboard/Controls/src/textbox.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@ function New-UDTextbox {
[Parameter()]
[Switch]$Disabled,
[Parameter()]
[UniversalDashboard.Models.FontAwesomeIcons]$Icon
[UniversalDashboard.Models.FontAwesomeIcons]$Icon,
[Switch]$Autofocus
)

$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
If ($Autofocus) {
$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
autofocus = "true"
}
}
else {
$Attributes = @{
type = $type
value = $Value
placeholder = $Placeholder
}
}


if ($Disabled) {
$Attributes.disabled = $true
Expand All @@ -43,4 +55,4 @@ function New-UDTextbox {
} -Content { $Label }
}
}
}
}

0 comments on commit 6749fbc

Please sign in to comment.