Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Configuration

Class Merge

How twblazor merges conflicting Tailwind classes so the last one wins, and how to turn it off or add your own utilities with TwBlazorOptions.ClassMerge.

Last updated 18 October 2026

Overview

Every twblazor component builds its class attribute from its theme classes, then your own Class. When two of those classes set the same CSS property, such as px-4 from the theme and px-2 from you, the one added last wins and the other is removed. Without merging, both would reach the element and the order of Tailwind's stylesheet, not your intent, would decide the result.

It is built into twblazor, so there is nothing to install and nothing to set up. ClassBuilder.Build() does the merge for every component. The sections below show the rules it follows, and every result in them is produced by ClassBuilder when this page renders, so it is always what the library really does.

The rules are those of the tailwind-merge npm package for Tailwind CSS v4. Its class groups are generated into twblazor from that package, and twblazor's tests compare the two on several hundred class strings. See Differences from tailwind-merge for the two places they part.

RAZOR
<TwButton Label="Compact" Class="px-2" />

@* Renders px-2 and no px-6. The colors, height and the rest of the theme are untouched. *@

Last conflicting class wins

Two classes conflict when they set the same CSS property, such as two paddings, two font sizes or two display values. Of the classes that conflict, only the one written last is kept. It stays exactly where you wrote it, the earlier ones are removed, and every class that is not part of the conflict keeps its place.

The classes do not need to be next to each other, and several conflicts are resolved in the same pass.

CSHARP
new ClassBuilder("p-5 p-2 p-4").Build(); // → "p-4"
new ClassBuilder("flex px-4 items-center px-2").Build(); // → "flex items-center px-2"
new ClassBuilder("text-sm font-bold text-lg font-normal").Build();
// → "text-lg font-normal"

Allows refinements

A shorthand such as p-3 sets several sides at once, and a class for one of those sides, such as px-5, is more specific. When the more specific class comes after the shorthand it refines it, so both are kept: padding everywhere, then a different horizontal padding.

The order decides it. The other way round, the shorthand comes last and covers everything the specific class set, so the specific class is removed.

CSHARP
new ClassBuilder("p-3 px-5").Build(); // → "p-3 px-5"
new ClassBuilder("px-5 p-3").Build(); // → "p-3"
new ClassBuilder("inset-x-4 right-4").Build(); // → "inset-x-4 right-4"
new ClassBuilder("rounded-lg rounded-t-none").Build(); // → "rounded-lg rounded-t-none"
new ClassBuilder("rounded-t-none rounded-lg").Build(); // → "rounded-lg"
new ClassBuilder("border-2 border-t-4").Build(); // → "border-2 border-t-4"

Resolves non-trivial conflicts

Classes with different names can still set the same property. The merge knows which Tailwind utilities overlap, including the cases that are easy to miss:
  • A shorthand and the classes it covers: p with px, py and each side, and the same for margin, inset, gap, overflow, border width, border color, rounded corners and scroll margin and padding.
  • size-8 sets both width and height, so it replaces an earlier w-4 and h-6.
  • flex-1 sets grow, shrink and basis, so it replaces earlier grow, shrink and basis-4.
  • line-clamp-1 sets display and overflow, so it replaces earlier classes for those.
  • Every display value conflicts with every other, as do the position values (static, relative, absolute) and the text decorations (underline, line-through).
  • A negative value conflicts with the positive class for the same property.
CSHARP
new ClassBuilder("inset-x-px -inset-1").Build(); // → "-inset-1"
new ClassBuilder("bottom-auto inset-y-6").Build(); // → "inset-y-6"
new ClassBuilder("inline block").Build(); // → "block"
new ClassBuilder("w-4 h-6 size-8").Build(); // → "size-8"
new ClassBuilder("basis-4 grow flex-1").Build(); // → "flex-1"
new ClassBuilder("overflow-auto inline line-clamp-1").Build(); // → "line-clamp-1"

Tells apart classes that share a prefix

Many Tailwind prefixes are shared by unrelated properties. text- is used for font size, color, alignment and wrapping. border- is used for width, color and style. bg- is used for color, image, size, position and repeat. The value after the prefix decides which property a class sets, and only classes for the same property conflict.

So text-lg replaces text-sm and leaves text-red-500 alone, and a background color never removes a background size or position.

CSHARP
new ClassBuilder("text-sm text-red-500 text-lg").Build(); // → "text-red-500 text-lg"
new ClassBuilder("border-2 border-red-500 border-dashed border-4").Build();
// → "border-red-500 border-dashed border-4"
new ClassBuilder("bg-red-500 bg-cover bg-center bg-blue-500").Build();
// → "bg-cover bg-center bg-blue-500"
new ClassBuilder("shadow-md shadow-brand shadow-lg").Build(); // → "shadow-brand shadow-lg"

Supports modifiers and stacked modifiers

Classes only conflict when they have exactly the same modifiers, because each set of modifiers applies in a different situation. hover:p-4 never removes p-2, and md:p-4 never removes lg:p-6. This holds for every kind of modifier: state (hover, focus, disabled), responsive (md, max-lg), color scheme (dark), group and peer (group-hover, peer-checked), and data and aria attributes.

When modifiers are stacked their order does not matter, so hover:focus: and focus:hover: are the same thing.

CSHARP
new ClassBuilder("p-2 hover:p-4").Build(); // → "p-2 hover:p-4"
new ClassBuilder("hover:p-2 hover:p-4").Build(); // → "hover:p-4"
new ClassBuilder("hover:focus:p-2 focus:hover:p-4").Build(); // → "focus:hover:p-4"
new ClassBuilder("md:p-2 md:p-4 lg:p-6").Build(); // → "md:p-4 lg:p-6"
new ClassBuilder("dark:hover:bg-red-500 hover:dark:bg-blue-500").Build();
// → "hover:dark:bg-blue-500"
new ClassBuilder("group-hover:p-1 peer-hover:p-2 group-hover:p-3").Build();
// → "peer-hover:p-2 group-hover:p-3"

Where the order does matter

Some modifiers change which element is styled: before, after, placeholder, file, marker, selection, first-line, first-letter, backdrop, details-content, * and **, and any arbitrary variant. Moving another modifier from one side of these to the other changes the CSS Tailwind produces, so before:hover:p-1 and hover:before:p-2 are treated as different and both are kept. If you define such a variant yourself with @custom-variant, add its name to OrderSensitiveVariants so it is treated the same way.

CSHARP
new ClassBuilder("before:hover:p-1 hover:before:p-2").Build();
// → "before:hover:p-1 hover:before:p-2"
new ClassBuilder("hover:before:p-1 hover:before:p-2").Build(); // → "hover:before:p-2"

Supports a Tailwind prefix

If your Tailwind build uses a prefix, Tailwind v4 writes it like a modifier at the start of the class, as in tw:px-4 or tw:hover:px-4. Prefixed classes are merged with no configuration, and everything on this page applies to them: refinements, modifiers, arbitrary values and the important modifier.

A prefixed class never conflicts with the unprefixed class of the same name. The two come from different stylesheets, so neither can stand in for the other.

CSHARP
new ClassBuilder("tw:px-4 tw:px-2").Build(); // → "tw:px-2"
new ClassBuilder("tw:pt-1 tw:py-3").Build(); // → "tw:py-3"
new ClassBuilder("tw:hover:px-4 tw:hover:px-2").Build(); // → "tw:hover:px-2"
new ClassBuilder("tw:px-4 px-2").Build(); // → "tw:px-4 px-2"

By default unprefixed classes are merged as well, which is right when the page mixes a prefixed and an unprefixed Tailwind build. If your whole application is prefixed, set Prefix to the value you gave prefix(...) in your stylesheet. Only classes that start with it are then treated as Tailwind utilities. Any other class, such as a hidden or container that belongs to another framework on the page, is left alone.

CSHARP
// app.css: @import "tailwindcss" prefix(tw);
builder.Services.AddTwBlazor(options => options.ClassMerge.Prefix = "tw", Theme.CreateTheme);

// "tw:px-4 tw:px-2" renders as "tw:px-2".
// "hidden block" is left as it is: without the prefix they are not Tailwind classes.
The option only tells the merge what to treat as Tailwind. It does not add the prefix to anything: your copy of the theme must already be written with it, because Tailwind only generates the classes it finds in your source.

Supports arbitrary values

Arbitrary values take part in the merge like any other value. That covers both the square bracket form, m-[10px], and the Tailwind v4 shorthand for a CSS variable, w-(--sidebar). An arbitrary value conflicts with the named values for the same property, in either order.
CSHARP
new ClassBuilder("m-[2px] m-[10px]").Build(); // → "m-[10px]"
new ClassBuilder("text-[14px] text-sm").Build(); // → "text-sm"
new ClassBuilder("w-(--sidebar) w-64").Build(); // → "w-64"
new ClassBuilder("bg-black bg-(--my-color) bg-[color:var(--mystery-var)]").Build();
// → "bg-[color:var(--mystery-var)]"
new ClassBuilder("grid-cols-[1fr,auto] grid-cols-2").Build(); // → "grid-cols-2"

Labels are necessary in ambiguous cases

A class like text-[calc(var(--rebecca)-1rem)] could be a font size or a text color, so the value is inspected for clues such as calc() or a number followed by a unit like 1rem. When the type can't be told from the value, as in text-[theme(myCustomScale.rebecca)], it is treated as a color. Add a CSS data type label, as Tailwind itself does, to say which one you mean: text-[length:theme(myCustomScale.rebecca)].

A variable in the shorthand form can never be inspected, so text-(--my-size) is always read as a color. Label it when it is something else: text-(length:--my-size). The labels are length, size, position, percentage, image, url, number, weight, family-name and shadow.

CSHARP
new ClassBuilder("text-2xl text-(--my-color)").Build(); // → "text-2xl text-(--my-color)"
new ClassBuilder("text-2xl text-(length:--my-size)").Build();
// → "text-(length:--my-size)"

Supports arbitrary properties

An arbitrary property, such as [mask-type:alpha], conflicts with another arbitrary property that has the same property name. CSS variables set this way work the same, so a later [--scroll-offset:44px] replaces an earlier one. Modifiers apply as they do everywhere else: the two only conflict when their modifiers match.
CSHARP
new ClassBuilder("[mask-type:luminance] [mask-type:alpha]").Build();
// → "[mask-type:alpha]"
new ClassBuilder("hover:[color:red] hover:[color:blue]").Build(); // → "hover:[color:blue]"
new ClassBuilder("[--scroll-offset:56px] lg:[--scroll-offset:44px]").Build();
// → "[--scroll-offset:56px] lg:[--scroll-offset:44px]"
Conflicts between an arbitrary property and the Tailwind class for the same property are not resolved. Don't write [padding:1rem] p-8 and expect one of them to go.

Supports arbitrary variants

Arbitrary variants, such as [&>*]: or [&:nth-child(3)]:, are modifiers like any other: two classes conflict when they have the same one. The selector is compared as written, so [&>*]: and [&>p]: are different.

Like arbitrary properties, an arbitrary variant is never matched against a predefined modifier, so [&:focus]:ring and focus:ring-4 are both kept. And because an arbitrary variant can change which element is styled, the order of the modifiers around it is kept too.

CSHARP
new ClassBuilder("[&:nth-child(3)]:py-0 [&:nth-child(3)]:py-4").Build();
// → "[&:nth-child(3)]:py-4"
new ClassBuilder("[&>*]:underline [&>*]:line-through").Build(); // → "[&>*]:line-through"
new ClassBuilder("[&>*]:p-1 [&>p]:p-2").Build(); // → "[&>*]:p-1 [&>p]:p-2"
new ClassBuilder("[&:focus]:ring focus:ring-4").Build(); // → "[&:focus]:ring focus:ring-4"
new ClassBuilder("hover:[&>*]:p-1 [&>*]:hover:p-2").Build();
// → "hover:[&>*]:p-1 [&>*]:hover:p-2"

Supports important modifier

An important class only conflicts with other important classes, and an ordinary class only with ordinary ones. An important class already beats the ordinary one in the browser, so removing either would change nothing or lose a fallback.

The modifier can be written after the class, p-4!, which is the Tailwind v4 form, or before it, !p-4, which is the older form Tailwind still accepts. The two forms conflict with each other, and both work with modifiers.

CSHARP
new ClassBuilder("p-3! p-4! p-5").Build(); // → "p-4! p-5"
new ClassBuilder("right-2! -inset-x-1!").Build(); // → "-inset-x-1!"
new ClassBuilder("!p-3 p-4!").Build(); // → "p-4!"
new ClassBuilder("hover:p-3! hover:p-4!").Build(); // → "hover:p-4!"
new ClassBuilder("p-3 p-4!").Build(); // → "p-3 p-4!"

Supports postfix modifiers

A postfix modifier is the part after a slash. In text-lg/7 it sets the line height as well as the font size, so the class also replaces an earlier leading-6. A leading class written after it refines it and is kept.

Elsewhere the modifier is an opacity, as in bg-red-500/50, and does not change what the class conflicts with. A slash that is part of the value, as in the fraction w-1/2, is not a modifier at all.

CSHARP
new ClassBuilder("text-sm leading-6 text-lg/7").Build(); // → "text-lg/7"
new ClassBuilder("text-lg/7 leading-9").Build(); // → "text-lg/7 leading-9"
new ClassBuilder("bg-red-500/50 bg-blue-500").Build(); // → "bg-blue-500"
new ClassBuilder("w-full w-1/2").Build(); // → "w-1/2"

Preserves non-Tailwind classes

A class that is not a Tailwind utility is never removed and keeps its place, so your own classes, component classes from other libraries and icon classes are safe. Such classes are not compared with each other either: writing one twice leaves it twice.

A class counts as a Tailwind utility only when its value is one Tailwind has. w-half starts like a width, but half is not a width Tailwind knows, so it is left alone and does not remove w-1/2.

CSHARP
new ClassBuilder("p-5 p-2 my-non-tailwind-class p-4").Build();
// → "my-non-tailwind-class p-4"
new ClassBuilder("btn btn-primary btn").Build(); // → "btn btn-primary btn"
new ClassBuilder("w-1/2 w-half").Build(); // → "w-1/2 w-half"

Supports custom colors out of the box

Where a utility takes a color, any name it has never seen is treated as a color. Colors from your own Tailwind theme therefore merge with no configuration, for text, background, border, ring, outline, shadow, fill, stroke and the rest. Custom font families work the same way.
CSHARP
new ClassBuilder("text-red text-secret-sauce").Build(); // → "text-secret-sauce"
new ClassBuilder("bg-brand bg-brand-dark").Build(); // → "bg-brand-dark"
new ClassBuilder("ring-brand ring-2 ring-other").Build(); // → "ring-2 ring-other"
new ClassBuilder("font-sans font-my-family").Build(); // → "font-my-family"

Custom sizes need a group

The same rule means a custom name that is not a color is misread. With --text-huge in your theme, text-huge is taken for a color and will not replace text-sm, and a custom radius such as rounded-brand is not recognised at all. Sizes named like Tailwind's own, such as text-3.5xl, are fine. For any other name, add the class to the built-in group it belongs to, as shown under Add your own utilities.

Composition

ClassBuilder merges once, when you call Build(), so you can add classes in as many calls as you like. The order of the calls is the order of the classes, which is why a component adds its theme classes first and your Class last. A conditional class takes part in the merge only when its condition is true.

Whitespace is tidied on the way: extra spaces, tabs and line breaks become single spaces, and a null or empty string adds nothing.

CSHARP
var classes = new ClassBuilder("some-class")
    .AddClass("another-class yet-another-class")
    .AddClass("so-many-classes")
    .Build();
// → "some-class another-class yet-another-class so-many-classes"

var compact = true;
var button = new ClassBuilder("px-6 py-2")
    .AddClass("px-2", compact)
    .Build();
// → "py-2 px-2"

Configuration

Merging needs no configuration. Leave ClassMerge alone and everything above applies. To change it, set it on the options you pass to AddTwBlazor. It is part of TwBlazorOptions, not the theme, and applies to your whole application.

The configuration is read once, when AddTwBlazor runs, so set it there and not later. These are the settings:

  • Enabled turns merging on or off. It is on by default.
  • Prefix is the prefix of your Tailwind build, such as tw. Classes without it are then left alone.
  • Groups holds your own class groups, for utilities the merge does not know.
  • OrderSensitiveVariants names custom variants whose position among the other variants matters.
  • CacheSize is how many results are remembered. It is 2,048 by default, and 0 turns the cache off.
CSHARP
builder.Services.AddTwBlazor(options =>
{
    options.ClassMerge.Enabled = true;   // the default
    options.ClassMerge.Prefix = "tw";    // only for a prefixed Tailwind build
    options.ClassMerge.CacheSize = 4096; // 2,048 by default
    options.ClassMerge.Groups.Add(new TwClassGroup("btn-size", ["btn"]));
    options.ClassMerge.OrderSensitiveVariants.Add("scrollbar");
}, Theme.CreateTheme);

Turn it off

With Enabled set to false every class is rendered exactly as written, with only the surrounding whitespace trimmed. Both the theme's class and yours then reach the element, and which one applies is decided by their order in Tailwind's stylesheet. Turn it off only if you resolve conflicts some other way.

CSHARP
builder.Services.AddTwBlazor(options => options.ClassMerge.Enabled = false, Theme.CreateTheme);

Add your own utilities

A TwClassGroup is a set of classes that conflict with each other. A class belongs to the group when it equals one of its prefixes or starts with the prefix and a dash, so the prefix btn matches btn, btn-sm and btn-lg, and does not match btns. Use it for classes you define with @utility or in your own CSS. Custom groups are checked before the built-in ones.

Classes in a custom group get the same treatment as Tailwind's: modifiers, the important modifier, a leading minus and a postfix modifier are all understood, so hover:btn-sm only conflicts with hover:btn-lg.

CSHARP
// Of btn, btn-sm and btn-lg only the last one added is kept.
options.ClassMerge.Groups.Add(new TwClassGroup("btn-size", ["btn"]));

// "btn-sm btn-lg flex" renders as "btn-lg flex".

Give a group the name of a built-in one to add your classes to it. This is how to teach the merge a custom size from your Tailwind theme: the class then conflicts with everything else in that group and inherits what the group overrides.

CSHARP
// text-huge comes from --text-huge in your Tailwind theme. In the font-size group it
// replaces text-sm, and an earlier leading-6, the way a built-in font size does.
options.ClassMerge.Groups.Add(new TwClassGroup("font-size", []) { Classes = ["text-huge"] });

// rounded-brand comes from --radius-brand.
options.ClassMerge.Groups.Add(new TwClassGroup("rounded", []) { Classes = ["rounded-brand"] });

// "text-sm leading-6 text-huge" renders as "text-huge".
// "rounded-md rounded-brand" renders as "rounded-brand".

Classes matches a class by its whole name, where a prefix would also match everything that starts with it. Use it for a single class such as text-huge, so that an unrelated text-huge-wide is not pulled into the group. A group can have prefixes, classes or both.

Override other groups

Set Overrides to the names of groups that a later class from this one also removes. It works in one direction, like Tailwind's own shorthands: a later pad-4 removes an earlier px-2, and a later px-2 refines an earlier pad-4, so both are kept.

Reusing the name of a built-in group, such as p, adds your classes to that group and keeps its existing overrides. The built-in groups are named as in tailwind-merge. The common ones are p, px, py, m, w, h, size, display, font-size, font-weight, font-family, leading, text-color, bg-color, border-w, border-color, rounded, shadow and shadow-color.

CSHARP
// A later pad-4 also removes earlier px and py classes.
options.ClassMerge.Groups.Add(new TwClassGroup("spacing-all", ["pad"])
{
    Overrides = ["px", "py"],
});

// Add gutter-* to the built-in padding group instead.
options.ClassMerge.Groups.Add(new TwClassGroup("p", ["gutter"]));

ModifierOverrides does the same, but only for a class written with a postfix modifier. This is how the built-in font sizes work: text-lg/7 removes an earlier line height and text-lg does not. Use it when the part after the slash in your own utility sets a second property.

CSHARP
// tile-2/50 sets an opacity as well, so it removes an earlier opacity-75. tile-2 does not.
options.ClassMerge.Groups.Add(new TwClassGroup("tile", ["tile"])
{
    ModifierOverrides = ["opacity"],
});

What it does not do

The merge only removes classes it is sure conflict. A few things are outside it:
  • It does not compare an arbitrary property with the utility for the same property, so [padding:1rem] p-8 keeps both.
  • It does not remove duplicates of classes that are not Tailwind utilities.
  • It does not reorder classes. What is kept stays where it was written.
  • It does not know your own utilities or custom size names until you add a group for them.
  • It does not read your Tailwind configuration, so it cannot tell whether a class exists in your build.

Differences from tailwind-merge

twblazor gives the same result as tailwind-merge except in two cases, where it follows what Tailwind itself generates.
  • An unlabelled arbitrary background value made of position keywords, such as bg-[right_0.5rem_center], is a background position, as it is to Tailwind. tailwind-merge reads it as a color unless you write bg-[position:right_0.5rem_center].
  • A line height modifier is recognised after the older important syntax too, so !text-sm/6 replaces an earlier !leading-4 just as text-sm/6! does.
CSHARP
new ClassBuilder("bg-red-500 bg-[right_0.5rem_center]").Build();
// → "bg-red-500 bg-[right_0.5rem_center]"
new ClassBuilder("!leading-4 !text-sm/6").Build(); // → "!text-sm/6"

Configuration differs too. tailwind-merge is extended with extendTailwindMerge and its own config format. twblazor has the settings listed under Configuration, set in C#. Its Prefix behaves like tailwind-merge's prefix, and Groups, Overrides and ModifierOverrides cover what classGroups, conflictingClassGroups and conflictingClassGroupModifiers do there.

Performance

Results are cached, so re-renders don't repeat the work. The cache is keyed on the full class string given to Build() and holds up to 2,048 different results before it starts again. Change that number with CacheSize if your application builds far more distinct class strings than that, or set it to 0 to always merge afresh. A component that renders with the same classes as last time gets its answer from one dictionary lookup.

On this page

  • Overview
  • Last conflicting class wins
  • Allows refinements
  • Resolves non-trivial conflicts
  • Tells apart classes that share a prefix
  • Supports modifiers and stacked modifiers
  • Supports a Tailwind prefix
  • Supports arbitrary values
  • Supports arbitrary properties
  • Supports arbitrary variants
  • Supports important modifier
  • Supports postfix modifiers
  • Preserves non-Tailwind classes
  • Supports custom colors out of the box
  • Composition
  • Configuration
  • Turn it off
  • Add your own utilities
  • Override other groups
  • What it does not do
  • Differences from tailwind-merge
  • Performance
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload