Setting CSS class css-<Something>-MuiFormControl-root

Setting CSS class css-<Something>-MuiFormControl-root

avatar
Product: PowerShell Universal
Version: 4.0.8


Greetings,

I am trying to style a New-UDSelect cmdlet inside a New-UDElement cmdlet.

My Code:

New-UDStack -id StackElement -Direction column -Content {
        New-UDSelect -Id "FirstSelectID" -Label "Company Name" -Option {
            New-UDSelectGroup -Name "Select a Number" -Option {
                New-UDSelectOption -Name "one" -Value "one"
                New-UDSelectOption -Name "two" -Value "two"
            }
        }

        New-UDElement -ClassName ElementClass -Id "ElementID" -Tag div -Endpoint {
            New-UDSelect -classname SecondSelectClass -Id "SecondSelectID" -Label "Environment" -Option {
                New-UDSelectOption -Name "one" -Value "one"
                New-UDSelectOption -Name "two" -Value "two"
            }
        }
}


When I lay out the code, the second Select box does not behave like the first select box:
21b5393d507ca83dfd793dcfe9aebf49649fc404


When looking at the code I have identified the class which is causing this however, I can not see a way to modify it:


a6ab40e0401215985896fc85181e5aa8acf00d31
The other problem is that the class css-pe0pe4-MuiFormControl-root appears to rename itself, which means whenever a change is made.

Does anyone have any ideas how i can set a value to a property under this style?

I have attempted wrapping a New-UDForm around this, however this does now allow me to set a static class name.

a6ab40e0401215985896fc85181e5aa8acf00d31.png

21b5393d507ca83dfd793dcfe9aebf49649fc404.png

avatar

Recommended Answer

What happens if you put -FullWidth on the UDSelect?

The css class being generated is based on styles directly in the component so that’s why it changes dynamically.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

All Comments (2)

avatar

What happens if you put -FullWidth on the UDSelect?

The css class being generated is based on styles directly in the component so that’s why it changes dynamically.

Adam Driscoll
PowerShell Expert and Developer at Devolutions

avatar

Hi @Adam Driscoll,

I have spun up a container to test that and it appears to work

When I get to the office in the morning, I will test that out on my dev environment.

Is it a general rule of thumb where if I see a randomly named CSS Stylesheet that will be a cmdlet parameter for a child DIV tag or do other parts of the stack do the same thing?

Thanks again,
Matt.