C
C#13mo ago
Leonardo

❔ Blazor wasm with custom styles

not exactly a help request or something like that, just wanted to know if someone else here already worked with Blazor wasm but had to use custom styles on it, like using different frameworks (tailwind, flowbite, bootstrap) and with custom templates, i'm asking this because most of the cases, custom templates use main javascript code and blazor must have JSInterop to run it so i was wondering if i could get any good advice or some cool examples to continue my studies on btw i dont intend on using mudblazor, havit, telerik or wahtever libs that have entire custom components.
13 Replies
Angius
Angius13mo ago
Just create a ComponentName.razor.css file next to your component and write the styles there That's the secret to custom styles
Leonardo
LeonardoOP13mo ago
uhm i mean yea thats works if im going to write everything from scratch i guess, im talking about using ready made libs for example
Angius
Angius13mo ago
Far as using Bootstrap goes... just include the necessary files and done In the index.html
Leonardo
LeonardoOP13mo ago
hm i tried importing the cdn js file direct in index.html but for some reason it looks like that the js source code wouldnt get compiled or something, have you already saw something like that? or does blazor have a different way to import js cdns we have js interop btw so it can be an option i guess
Angius
Angius13mo ago
Nope Just include the scripts, include the styles, done
Angius
Angius13mo ago
Stack Overflow
How to setup bootstrap 5 to Blazor Client project
VS templated project of BlazorWebassembly contents the Bootstrap4. Can anybody to help setup bootstrap 5 to BlazorWebassembly project
Leonardo
LeonardoOP13mo ago
i suppose we could apply the same process to this guy here: https://flowbite.com/ the only problem i was dealing with was with the js cdn so maybe if i make some tests with different situations maybe i could get somewhere but anyways thanks for answering me
Angius
Angius13mo ago
Tailwind CSS Blazor (.NET) - Flowbite
Learn how to install Tailwind CSS with Flowbite for your Blazor (.NET) project and start developing modern web applications based on the full-stack framework
Leonardo
LeonardoOP13mo ago
knowing that i should be able to import js cdns without relying on jsinterop is already enough to me
Angius
Angius13mo ago
Flowbite has a whole-ass documentation for using with Blazor
Leonardo
LeonardoOP13mo ago
yeah i saw that but i was trying to use only the cdns instead cuz i didnt want to use node modules but yea i guess i dont have too many exits lmaoo i will make some more tests here im pretty sure im just being dumb af thanks for your pattience and attention man
Joschi
Joschi13mo ago
And there are the obvious build for Blazor UI libs, like Blazorise, Mudblazor and so on
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server