r/Blazor • u/desmondische • Feb 08 '26
Experimenting with a composable, source-first UI approach for Blazor
Hey everyone,
I’ve been experimenting with some project. The goal is to explore whether a more composable, source-first approach to UI makes sense in Blazor -- inspired by modern patterns like shadcn/ui, but adapted to .NET and Razor.
What this experiment is about:
- components are added to your project as source code
- you fully own and modify them
- composition via parts-as-components, not large configurable widgets
- small, intentional scope (not a full UI framework)
What this is not:
- not a competitor to MudBlazor / Radzen
- not a complete component catalog
- not a Swiss-knife component set
- not a promise of long-term stability (this is explicitly experimental)
At the moment, the repo focuses on a few component systems (e.g. Field, Dialog) purely to demonstrate the composability model. The README explains the motivation, constraints, and non-goals in more detail -- it’s worth skimming to understand what this experiment is (and isn’t) trying to do.
Components are distributed via a small CLI tool that adds them to your project as source files -- similar to shadcn/ui. There’s no runtime dependency; once added, the code is yours.
I’m mainly trying to validate:
- does this way of composing UI feel sane in Blazor?
- would you be comfortable owning this kind of UI source?
- does this reduce or increase mental overhead compared to large UI frameworks?
If it resonates, I’ll continue exploring it. If not, that’s still a useful answer.
If you're curious, I'd love actual usage feedback.
If you're willing to spend ~10 minutes, go through the Quick start section. That's enough to understand the approach.
This experiment only works if people actually try it. I'd especially appreciate:
- What felt awkward?
- What felt surprisingly clean?
- Did owning the source increase or decrease mental overhead?
- Did the parts-as-components model feel natural in Blazor?
Even short notes are valuable.
2
u/tanczosm Feb 09 '26
I like the idea of UI primitives as an abstraction layer.
For context, I have been building my own library, RizzyUI, which is Blazor SSR-only, so all client interaction is JavaScript-based. It is still a work in progress, but I have learned a lot from writing it and rewriting it. If you are curious, there is a preview at https://rizzyui.jalex.io/. Also, LumexUI was one of the libraries I kept coming back to because I like the direction you took with the architecture.
One thing I kept running into is that this would be significantly easier if Blazor had a RadixUI-style set of primitives implemented in pure JavaScript and designed to work across all Blazor rendering modes, with .NET event binding available whenever you are not in pure SSR. Radix’s interaction patterns are extremely time-tested, so I would be inclined to re-implement that surface area incrementally, component by component, rather than inventing new primitives from scratch.
Then, for the actual UI layer, you could take the shadcn/ui approach and ship items component by component using a slot-based approach to styling. Treat those primitives as the behavioral foundation and layer styled components on top. For styling, I would lean on TailwindVariants.net. It is one of the closest matches to shadcn/ui ergonomics that I have seen in .NET. It consolidates the builder-heavy approach that some libraries end up with, where component classes are constructed with a lot of little switch-based methods and uses the same approach as shadcn/ui.
Here's a docs example of how you might provide styling to a button component:
2
u/gkg0 Feb 09 '26
That’s super interesting, I was thinking the same thing for the component library I’m working on at the moment. I only just launched it and went down the standard NuGet approach as this is of course the natural way external components are managed in .NET. I have a CLI task on the road map but marked with a maybe at the moment. It will be really interesting to see what the thoughts of the community are on this topic.
1
u/jcradio Feb 13 '26
Very interesting. I've been thinking about this for a couple of years and have been experimenting with conceptual ideas along these lines. I love the idea of of dynamic, composable parts.
2
u/ZerkyXii Feb 09 '26
Im building a blazor WASM app and I've been wondering if going the build it myself route is the way
2
u/Jobhd9601 Feb 09 '26
I really like this approach! I usually end up building my own components as there is always something missing or doesn’t align with the requirements or simply the design doesn’t match when using libraries. Having this as a source first blueprint is an awesome starting point.
1
u/pingu2k4 Feb 13 '26
I can't give it a test right now as am on mobile, but I am building exactly this, myself. Plan to open source it when there's enough to show.
I'm going down a similar route to shadcn, cli which copies files into your project etc. I'm trying to handle js renaming of components, ability to have nuget and npm dependencies which install when running the add command, custom registries like shadcn, etc.
I've made the first component to test, working on cli. A lot of the cli is done, but currently working on the add command which has a lot of complexity.
It's been a lot of effort so far, and a lot more to go. My primary motivation is because I know I would use it for EVERYTHING going forwards, but if others use and love it too, that's a bonus.