Theming
NeoUI is 100% compatible with shadcn/ui themes. Use any theme from the shadcn/ui gallery, generate one with tweakcn, write your own CSS variables, or use Theme v2 to unlock style variants, radius presets, and font presets.
How Theming Works
All NeoUI components use CSS custom properties (variables) for their colors, spacing, and radius. Switching a theme is as simple as swapping out those variable definitions — no recompiling, no class changes, no JavaScript framework needed.
The included theme files (_content/NeoUI.Blazor/css/themes/)
ship ten base palettes and seventeen primary accent colors, giving you
170 ready-to-use combinations out of the box — plus optional style variants, radius presets, and font presets introduced in Theme v2.
Pre-Built Theme System
Include theme CSS files in App.razor after components.css:
Base colors (10)
- zinc · slate · gray · neutral · stone
- + new in v4: luma · mist · mauve · taupe · olive
Primary accent colors (17)
- red · rose · orange · amber · yellow · lime
- green · emerald · teal · cyan · sky · blue
- indigo · violet · purple · fuchsia · pink
Production Tip
ThemeSwitcher
component to work fully, load all base, primary, style variant, radius, and font files.
Theme v2 — Style Variants & Presets
Theme v2, introduced in v4.0.0, adds style variants, radius presets, font presets, and sidebar color/accent options layered on top of the base + primary color system — giving you far more expressive control without writing any custom CSS. 10 base colors × 17 primary colors = 170 combinations, plus 7 style variants, 4 radius options, and 6 font options.
AppProvider — Required Wrapper
Theme v2 distributes the active StyleVariant
to every component via a CascadingValue.
Wrap your main layout content with AppProvider
— components outside it permanently receive StyleVariant.Default.
StyleVariant Enum
Six visual treatment options for components. The CSS file for each variant must be loaded in App.razor.
StyleVariant.Default
Classic shadcn/ui-aligned look — clean and neutral.StyleVariant.Vega
Soft, warm treatment with subtle gradients.StyleVariant.Nova
Crisp, modern variant with strong contrast.StyleVariant.Maia
Rounded, friendly aesthetic inspired by soft UI.StyleVariant.Lyra
Minimal, editorial style with open whitespace.StyleVariant.Mira
Bold, vivid accents with high-energy presence.StyleVariant.Luma
Luminous, lightweight variant optimized for bright themes.RadiusPreset Enum
Controls global border-radius. Load a radius CSS file in App.razor to activate.
RadiusPreset.None
Square corners — radius: 0.RadiusPreset.Small
Slightly rounded — radius: 0.25rem.RadiusPreset.Medium
Default rounded — radius: 0.5rem (matches shadcn/ui default).RadiusPreset.Large
Strongly rounded — radius: 0.75rem.FontPreset Enum
Sets --font-sans and the new
--font-heading CSS variable.
Load a font CSS file in App.razor to activate.
FontPreset.System
System UI font stack — no web font loaded.FontPreset.Inter
Inter — clean and highly legible sans-serif.FontPreset.Geist
Geist — Vercel's modern mono-influenced sans.FontPreset.CalSans
Cal Sans — expressive heading font (sets --font-heading).FontPreset.DmSans
DM Sans — rounded, approachable sans-serif.FontPreset.PlusJakarta
Plus Jakarta Sans — geometric and contemporary.MenuColor & MenuAccent
Control sidebar/navigation appearance independently of the main component style.
Built-in ThemePresets
Apply a full preset (base + primary + style + radius + font) in one call. The CSS for all referenced files must be loaded in App.razor.
ThemeService v4 API
CSS Load Order
The cascade order matters — each layer builds on the previous. Load all desired files in App.razor in this exact order:
All optional files must come after components.css
components.css.
The theme.js script must be the final item in <head>.
Dynamic Theme Switching
NeoUI includes a built-in theme switcher that lets users pick their preferred color combination
at runtime. Changes apply instantly without a page reload, and the selection is persisted via
localStorage.
Add the components to your layout header:
For programmatic control, inject ThemeService:
Custom CSS Theme
You can use any theme from ui.shadcn.com/themes
or tweakcn.com.
Copy the generated CSS and paste it into wwwroot/styles/theme.css:
Then reference it in App.razor at step 7 in the load order — after all NeoUI CSS files but before theme.js:
Load Order Matters
components.css
and all NeoUI theme files, but before theme.js.
See the CSS load order in the Theme v2 section above.
Available CSS Variables
These are the standard shadcn/ui variables NeoUI reads. You can override any of them.
Dark Mode
Dark mode is controlled by the presence of the dark
class on the <html> element.
All NeoUI components automatically switch to dark mode colors when this class is present.
The included theme.js script initialises
the correct class on page load to prevent a flash of unstyled content.
The DarkModeToggle component handles switching:
Using Tailwind CSS Alongside NeoUI
NeoUI works out of the box without Tailwind — components.css
handles all component styling. If you want Tailwind utility classes in your own layouts and pages
(e.g. bg-primary,
text-muted-foreground,
border-border), you can
add a Tailwind v4 build pipeline to your Shared project. The key integration point is the
tailwind.config.js
— it maps all NeoUI CSS variables to named Tailwind colors, so your utility classes and
the active NeoUI theme always stay in sync automatically.
Tailwind CSS v4
tailwind.config.js-only
approach with a CSS-first configuration via
@import 'tailwindcss'.
The tailwind.config.js
is still used for content scanning and theme token extension.
1. Install Tailwind v4
Add a package.json in
your Shared project (alongside the .csproj)
and install the CLI:
Or add the packages directly to your
package.json:
2. Create the CSS input file
app-input.css is the entry
point Tailwind reads. It pulls in Tailwind v4 itself, your NeoUI CSS variable theme, and any
custom CSS you need. The compiled output is written to
app.css.
3. Configure tailwind.config.js
Place this file next to your .csproj.
The content array tells Tailwind
where to scan for class names. The theme.extend.colors
section wires every NeoUI CSS variable to a named Tailwind color — this is what makes
bg-primary or
text-muted-foreground theme-aware.
4. Integrate with the .NET build
Add MSBuild targets to your .csproj
so dotnet build automatically
runs npm install and compiles
Tailwind before the Razor project builds.
5. Reference the output CSS in App.razor
Add the generated app.css
after components.css. Use
@Assets[...] so the URL is
fingerprinted for cache invalidation. Replace YourApp.Shared
with your Shared project's assembly name.
Exclude build files from publish output
package.json,
package-lock.json, and
tailwind.config.js
to a <Content Remove="..." />
item group in your .csproj
so they are not included in the published output.