I’m writing a dashboard that will query a server for information. I have the info set in an object, but I’m having troubles displaying this information in a vertical, line-by-line, Format List type view. With this being a single object, I do not want to use a table; else it will be a single row with multiple columns and that looks weird. I’m trying to use New-UDCard to display the data vertically, line-by-line. I’d like to have it look good with white space to line up values, such as…
Server Name: <servername>
OS Name: <OSname>
Total RAM: <totalRAM>
etc.
I’ve tried piping the object to format list, then out-string. This works, but the output on the card does not respect the white spacing and the values are not aligned.
I’ve tried creating a here string, with all the proper spacing the way I want it, but I get the same results; where New-UDCard does not respect the white space and the values are not aligned.
I’ve tried using HTML as well, both as -Content and as -Text. As -Content I get a nice looking key (as bold) and the value, but there are no line breaks; it just jams them up in a single horizontal line. When I use -Text I simply get the text, or if I use -Text as a here string I get “UniversalDashboard.Models.RawHtml”.
hello @Mentat I think you need to have a butchers at this old post:-
as it is related…as for the alignment of the text, you will most likely have to achieve this via CSS and either set it as a theme or use udhelmet module to set the CSS on this particular part of your page
Apologies for the late response, life and work got busy! Unfortunately I do not know CSS, and only a little HTML. However, I am tenacious and I kept digging and testing to figure it out. That old article you sent did help.
I found that New-UDParagraph will take New-UDHtml, where it will respect line breaks with <br>
and you can add additional white spaces using This works both with New-UDPaper and New-UDCard.
Once I have my data loaded into variables, I can do the following…