r/Blazor • • 9h ago

Blazix: shadcn/ui and Base UI ported to Blazor. A CLI copies the components into your project. MIT, no Node.

0 Upvotes

A couple days ago I asked here whether anyone wanted a proper shadcn/ui port for Blazor. Most of you said no, and you gave fair reasons. I've released it anyway. Here's what it is, what it isn't, and where I need help.

What it is

  • 60+ styled components that you own. dnx Blazix.Cli init, then dnx Blazix.Cli add dropdown-menu. The .razor files are copied into your project, one folder per component. They're your code, so edit them however you like.
  • 40+ headless primitives, ported from Base UI. dotnet add package Blazix.Primitives. They handle behaviour, keyboard, focus and ARIA, with no styles. You can use them on their own, without the styled layer.
  • No Node. Tailwind runs through its standalone CLI as part of dotnet build. There's no npm and no package.json.
  • Every render mode. It works on Interactive Server, WebAssembly and Auto, prerendered or not. If your app has a .Client project, init detects it. The components go in the client, and Tailwind goes in the server project, which scans the client's files.
  • Right-to-left. init --rtl copies the components with logical classes. Arrow keys and popup placement follow the text direction.
  • MIT licensed.

Docs: https://blazix-ui.com Repo: https://github.com/HGCollier/Blazix

"Why not just use BlazorBlueprint, or contribute to it?"

BlazorBlueprint is a good library. If it works for you, keep using it. The difference is how you get the code. Blueprint ships as a package. Blazix gives you the source and gets out of your way. Adding that to Blueprint wouldn't be a PR, because it changes how the whole project is put together. Not everyone will care about that, and that's fine. I wanted it, so I built it.

Accessibility

Several of you said shadcn ports usually fall down here, so here's exactly where it stands:

  • The target is WCAG 2.2 AA, with the patterns from the WAI-ARIA APG.
  • Every primitive was checked in the browser, in both Chromium and Firefox: keyboard, focus management, ARIA state, and axe scans. Those checks aren't automated in the repo yet. That's next.
  • It hasn't been tested by hand with screen readers or voice control, and it hasn't been audited. As someone pointed out last time, axe only catches a fraction of issues. So I'm not claiming it's accessible. I'm saying accessibility is the top priority, and I'd rather hear about the failures than have people assume it passes.

If you use NVDA, JAWS, VoiceOver, TalkBack or Voice Access and something doesn't work, please open an issue. Even a one-liner like "the combobox announces nothing in NVDA + Firefox" helps a lot.

AI

As I said last time, I used AI heavily to build this. I directed it, reviewed the output and tested it. The code is right there to judge, which is the point.

Not done yet

  • Automated tests in the repo (bUnit plus Playwright for .NET)
  • Chart, and a diff command to preview upstream changes before overwriting yours
  • Testing on Safari, on macOS and Linux (it was built on Windows), and with AOT in Auto apps

Feedback, criticism and issues are all welcome.