Any chance we could do inline CSS like https://lcui.lc-soft.io/ does it? I'm a huge fan of having everything in one file during prototype phases, makes things so much easier.
UXML does support inline styles, per element, just like in HTML. You do this via the style attribute. Here's an example: Code (CSharp): <VisualElement style="width: 200px; height: 40px" /> We don't have support for a full StyleSheet embedded in the UXML, or in C#, but are actively looking at ways we could add that in the future.
Inline styles per element seems like a bad practice in my opinion. Is there a point in including the bad parts of HTML in this library? I think it only makes sense to have style="" when you can include variables in there ( e.g. style="width={percentageValue}%" ), just like in React (or React Native). So if we can have style, can we also bind values in there somehow? Anyway, I found scoped CSS much better for readability in general when doing static style overrides
They can be handy when you just simply want a component to be e.g. 40px wide. Moving one property to a stylesheet in a separate file seems like overkill, especially if no other component is going to share this. If you start adding more style properties to the component, or decide it needs to be replicated, it's quick and easy to move it to a stylesheet, but I encounter a few cases where keeping the style inline improves readability and reduces bloat in the code.
I'm not talking about a separate file for one small change, I'm talking about something like that example on that website I provided. Code (CSharp): <style> .button-hello { margin: 0 0 0 25px; width:100px; b { color:red; } u { color:orange; } } </style> <button class="button-hello">Hello, <b>W</b><u>orld</u>!</button> <button class="button-hello">SecondButton, Hello <b>W</b><u>orld</u>!</button> vs Code (CSharp): <button style="margin: 0 0 0 25px;width:100px">Hello, <b style="color:red">W</b><u style="color:orange">orld</u>!</button> <button style="margin: 0 0 0 25px;width:100px">SecondButton, Hello <b style="color:red">W</b><u style="color:orange">orld</u>!</button>
I can definitely see use cases for this feature, but given a separate StyleSheet works too, it won't be our priority for the short term. Nevertheless, I added it to our tasks.