Custom Styling Components Recommendations #2070
Replies: 2 comments 1 reply
-
With regards to recommendation 1: If you use the If you use the
|
Beta Was this translation helpful? Give feedback.
-
I should have written
From a coding style perspective, I have a preference for using CSS to style my applications where possible. These applications run on multiple form factors from phones to desktops with extra wide screens and need to be responsive. This preference comes with a cost. It is more error prone and complex since targetting the underlying web components is sometimes required. The help provided by the tooling like intellisense is not always available which can be a productivity killer. Changing the underlying CSS variables used to support Design Tokens can break things since some are part of the recipes used ensure consistency and accessibility. Overall, this is my goto UI library for Blazor. |
Beta Was this translation helpful? Give feedback.
-
There are many challenges with custom styling applications using FluentUI Blazor components. These components are based on Fluent UI Web Components that favors consistency over flexibility. The FluentUI Blazor library just provides a convenient wrapper. The styling of a component is based on one or more design tokens. These tokens make up a theme. Changing a design token changes all elements that use that token for styling.
Changing the style of a particular Blazor component is further complicated by the extensive use of the shadow dom. A web component's styling can be isolated from the global CSS system which can make custom styling difficult.
My custom styling recommendations, in order, are the following:
Below is an example of using the last resort:
Displays the following:
I hope someone finds this helpful.
Beta Was this translation helpful? Give feedback.
All reactions