twblazor: Tailwind CSS components for Blazor

Quality gate status Bugs Reliability Rating Security Rating Coverage Duplicated Lines (%) Lines of Code Technical Debt License: MIT Stars Contributors Discussions NuGet Version NuGet Downloads

Alt

API Documentation (docfx) • Component Documentation (twblazor.com) • Get Started • AI Agents & Skills • Support development 💜

Contents

Why twblazor?

  • Every component is styled with plain Tailwind CSS classes, so there is no built-in CSS to fight when you want something to look different.
  • All styles live in one typed theme file. Change a color, spacing or radius there without digging through component internals.
  • See your changes straight away with Tailwind and hot reload.
  • Built-in class merging: a Class you pass to a component replaces the theme's conflicting utility instead of both reaching the element.
  • Accessibility comes first, with ARIA attributes and keyboard navigation built into the components.
  • Open source under the MIT license, free for personal and commercial projects.
  • Actively maintained, with new components, accessibility fixes and documentation landing regularly.
  • Contributions, issues and feedback are welcome from everyone using it.

Using twblazor in your own project? Share it here. We would love to see what you're building!

Setup

The fastest way to start is the project template. Install the twblazor.templates .NET tool once (update it later with dotnet tool update -g twblazor.templates):

dotnet tool install -g twblazor.templates

Then create a complete app. The command creates the solution, pages, layout, theme and Tailwind build, restores the packages and prints how to run it. Every option is optional:

twblazor new MyApp -i auto -t sidebar -f net11.0
Option Values Default
-i, --interactivity server, wasm, auto server
-t, --template dashboard, sidebar, navbar, blank dashboard
-f, --framework net11.0, net10.0 net11.0
-o, --output Folder to create the app in ./MyApp
--tailwind cli (through npx) or npm Asks, or cli when not interactive
--no-restore Skip dotnet restore
--no-npm Skip the Tailwind CSS build
--force Write into a folder that is not empty

-f needs twblazor.templates 3.6.0 or later. twblazor new is the only command you need after the tool is installed. If you are adding twblazor to an existing app instead, install the twblazor NuGet package and follow the Get Started guide for stylesheets, imports, providers, theming and dependency injection:

dotnet add package twblazor --version 3.7.0

Class merging

A Class you pass to a component replaces the theme's conflicting Tailwind utility, so Class="px-2" wins over the theme's px-4. It is built in and needs no setup. See the Class Merge docs for the rules and how to turn it off or teach it your own utilities.

Localization

Component text and date and time formats follow CultureInfo.CurrentUICulture. English and 23 more languages ship with the package, and right to left cultures mirror every component. See LOCALIZATION.md for the languages, changing the wording and right to left layouts, or the Localization docs for every key and option.

AI agent skills

Using Claude Code or another AI coding agent? twblazor publishes skills that teach it to set up, theme, localize and build with the real components and parameters. See AI-AGENTS.md to install them, or AI Agents & Skills on the docs site.

Supported .NET versions

twblazor .NET 11 .NET 10
3.7.0 and later ✅ ✅
3.6.x and earlier ➖ ✅

From 3.7.0 the package is built for both .NET 11 and .NET 10, so it installs into either without any extra setup. Upgrade to 3.7.0 or later before moving an app to .NET 11. See SECURITY.md for which release lines receive security fixes.

Dependencies

  • Tailwind CSS - A utility-first CSS framework for styling components.
  • Bootstrap Icons - An open-source icon library used for our TwIcon component.



Support twblazor on Buy Me a Coffee

This library is powered by Tailwind, Blazor and a dangerous amount of coffee.
You can help with that last one at buymeacoffee.com/twblazor. Thank you! ☕