TailwindCSS.Blazor 1.0.18

dotnet add package TailwindCSS.Blazor --version 1.0.18
                    
NuGet\Install-Package TailwindCSS.Blazor -Version 1.0.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TailwindCSS.Blazor" Version="1.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailwindCSS.Blazor" Version="1.0.18" />
                    
Directory.Packages.props
<PackageReference Include="TailwindCSS.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TailwindCSS.Blazor --version 1.0.18
                    
#r "nuget: TailwindCSS.Blazor, 1.0.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TailwindCSS.Blazor@1.0.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TailwindCSS.Blazor&version=1.0.18
                    
Install as a Cake Addin
#tool nuget:?package=TailwindCSS.Blazor&version=1.0.18
                    
Install as a Cake Tool

TailwindCSS.Blazor

A .NET library that integrates Tailwind CSS CLI with Blazor applications, featuring automatic hot-reload functionality.

How it works

This package implements hot-reload by fetching CSS and injecting it into a style tag while removing the old link tag. Sometimes when viewing the Elements panel in Chrome, these style tags may not be visible because when .NET hot reload is working correctly, it overwrites the header - this doesn't affect functionality.

Additionally, if .NET hot reload isn't working, this package will continue creating new style tags ensuring that app.css hot reload still functions properly.

Features

  • Hot-reload support for development on blazor Interactive Auto mode

Installation

## Project Structure Overview

Blazor1/
├─ Blazor1/
│  ├─ Blazor1.csproj    <--- 4 intall nuget package
│  ├─ app.css           <--- 1 add this file
│  ├─ Component/
│  │  └─ App.razor      <--- 5,6 add style & hot reload script
│  │....
│  ├─ Program.cs        <--- 7 add code for run cli & integrated hot reload when run
│  └─ wwwroot
├─ Blazor1.Client/
│  ├─ Blazor1.Client.csproj
│  │....
│  └─ wwwroot
├─ tailwind.config.js   <---- 2 add this file
├─ package.json         <---- 3 install npm package 
└─ node_modules/
  1. add new app.css file to a root project and fill the following code
@import "tailwindcss";
  1. At parent folder (folder that contain folder Blazor1 and Blazor1.Client) add tailwind.config.js file to a root project and fill the following code
module.exports = {
    content: [
        "./**/*.html",
        "./**/*.razor",
        "./**/*.cshtml",
        "./**/*.js",
        "./**/*.ts",
    ],
    theme: {
        extend: {},
    },
    plugins: [],
}
  1. Ensure nodejs is installed. At root install package
npm install tailwindcss @tailwindcss/cli
  1. Install this package via NuGet
dotnet add package TailwindCSS.Blazor
  1. At App.razor file, add <link rel="stylesheet" href="@Assets["css/app.css"]"/> before </head> tag
<head>
    ....
    <link rel="stylesheet" href='@Assets['app.css"]'/>  
</head>
  1. At App.razor file, add <script src="_content/TailwindCSS.Blazor/tailwindcss-blazor-hot-reload.js"></script> before </body> tag
<body>
    ....
    <script src="_framework/blazor.web.js"></script>
    <script src="_content/TailwindCSS.Blazor/tailwindcss-blazor-hot-reload.js"></script>  
</body>
  1. At Program.cs of web project add two lines
builder.AddTailwindCSS(); // <-- add this line

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseTailwindCSS(); // <-- add this line
    app.UseWebAssemblyDebugging();
}
  1. Run a Blazor project. (can run with F5 or by dotnet run command)
  2. Change app.css file or razor file. The tailwind-cli will output to wwwroot/css/app.css and it will auto hot reload via websocket.

Tailwind Configuration

You can configure Tailwind CSS settings in the tailwind.config.js file.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.18 275 9/6/2025