Product: PowerShell Universal
Version: 1.5.14
Hi gang!
I’d like to create a pretty large Textbox in order for a user to be able to enter a big chunk of text (3-4 lines). How can I do that?
I looked at the New-UDTextBox for a multiline parameter with no luck.
Thanks for your help.
Arnaud
adam
April 12, 2021, 2:19pm
2
Hey @apetitjean
New-UDTextbox has multiple.
$Pages += New-UDPage -Name 'Test' -Content {
New-UDTextbox -Multiline
}
You can just press enter in the textbox to add a new line.
You can also use -Rows to specify the number of starting rows.
$Pages += New-UDPage -Name 'Test' -Content {
New-UDTextbox -Multiline -Rows 5
}
Wow nice! Thanks @adam for your lighting fast reply!
I haven’t seen that in the doc.
Do you know if I could use another component that could resemble to a text editor?
Do you have any in stock ;-)?
adam
April 12, 2021, 2:28pm
4
If you want something a bit more full-featured, definitely check out the Code Editor component: Code Editor - PowerShell Universal
That’s awesome!
It’s like Apple, there’s always a component for that in PSU
I understood Code Editor component is the one of VSCode which is just awesome.
Do you think it could be possible to do this with PSU?
Here my scenario :
A user enters a multiline markdown string or multi markdown strings in Code Editor
The user can see the render of his input just like in VSCode either by clicking a button or in realtime (like in VSCode when editing Markdown)
Thanks
adam
April 12, 2021, 4:57pm
7
Totally. Here’s an example.
New-UDDashboard -Title 'Title' -Content {
New-UDRow -Columns {
New-UDColumn -LargeSize 6 -Content {
New-UDCodeEditor -Language markdown -Id 'code' -Height 400
New-UDButton -Text 'Render' -OnClick {
Sync-UDElement -Id 'output'
}
}
New-UDColumn -LargeSize 6 -Content {
New-UDDynamic -Id 'output' -Content {
$Code = (Get-UDElement -Id 'code').code
New-UDHtml ($Code | ConvertFrom-Markdown).Html
}
}
}
}
Many thanks Adam. This is exactly what I looked for!
Would it be possible to have a simple multiline textarea like in the screenshot below? See “Votre message” section.
adam
April 13, 2021, 9:35pm
10
We support the Material UI multiline text box: Text Field React component - Material-UI
https://docs.powershelluniversal.com/dashboard/components/inputs/textbox#multiline
It doesn’t quite have the formatting your are looking for but if you set the -Rows parameter it should look a little more like that. It does seem like we could add a variant parameter so you could get the outlined effect.
If you could add something that modifies slightly the presentation by boxing the components that could be nice.
See the screenshot below.
adam
April 13, 2021, 11:31pm
12
Cool. I’ve implemented this. You’ll be able to do this in 1.5.16 to achieve this effect.
New-UDTextbox -label "Label" -Multiline -Rows 5 -Variant outlined