scottkuhl / FluentBootstrap

Fluent UI variables for Bootstrap
MIT License
14 stars 4 forks source link

Blazor #2

Closed lonix1 closed 2 years ago

lonix1 commented 2 years ago

Have you found a way to use this with blazor?

scottkuhl commented 2 years ago

If you are using the default templates from Microsoft they are based on Bootstrap, but they are not setup for Sass. And the newer templates based on .NET 6 are based on Bootstrap 5, not 4 like these were setup for. But it should not be too much work to get it working.

  1. Copy the bootstrap.scss, _dark.scss, _light.scss into a folder in the wwwroot/css folder of the Blazor client project.
  2. Import Bootstrap using something like Libman from unpkg so you get the source files as well. (In Visual Studio this is under Add > Client Side Library when right clicking on the project)
image
  1. Update the path in your bootstrap.scss file to be:

@import "../lib/bootstrap/scss/bootstrap";

  1. Compile the file. You can use the Web Compiler extension in Visual Studio.
  2. Update the index.html file to point to the compiled css file.

<link href="css/bootstrap.min.css" rel="stylesheet" />

Everything is then wired up to use the light theme. You will need to update the _light.scss and _dark.scss files to match any changes from Bootstrap 4 to Bootstrap 5.

https://getbootstrap.com/docs/5.0/migration/

lonix1 commented 2 years ago

I looked everywhere for a blazor theme that looks like fluentui. You'd think that since blazor is a MS product, and many organisations adopted blazor, and probably use azure/office365/windows, that there'd be a fluentui/fast theme - but there isn't.

This is the only repo I've found that helps in this matter... it's not perfect but it takes you most of the way there, thanks!

scottkuhl commented 2 years ago

I looked everywhere for a blazor theme that looks like fluentui. You'd think that since blazor is a MS product, and many organisations adopted blazor, and probably use azure/office365/windows, that there'd be a fluentui/fast theme - but there isn't.

I agree. I am really surprised we have not seen a Fluent native Blazor library from them. Fast is just some fluent wrappers on JavaScript.

IMO, MS would be better off focusing on Blazor Native for desktop and mobile, port all their controls including the Windows Community Toolkit to Blazor and sunset Xamarin / Maui. Blazor has so much momentum right now, and Maui and WinUI need so much work.

Hope this helps though in the meantime.

lonix1 commented 2 years ago

Agreed. To add to that, the most amazing piece of tech I've seen recently is the Mobile Blazor Bindings project. It's a pity they prioritised MAUI over that.