Table of Contents

Struct ClassBuilder

Namespace
TwBlazor.Utilities
Assembly
TwBlazor.dll

Builds a string of css classes. Build() merges conflicting Tailwind utilities, so the class added last wins (a consumer's px-2 replaces a theme's px-4) instead of both reaching the element. How it merges is configured through ClassMerge.

public struct ClassBuilder
Inherited Members

Constructors

ClassBuilder(string)

public ClassBuilder(string value)

Parameters

value string

Methods

AddClass(string)

Adds a css class to the string.

public ClassBuilder AddClass(string value)

Parameters

value string

The css class to add.

Returns

ClassBuilder

ClassBuilder

AddClass(string, bool)

Adds a conditional css class to the string.

public ClassBuilder AddClass(string value, bool condition)

Parameters

value string

The css class to add.

condition bool

Only add if condition is true.

Returns

ClassBuilder

ClassBuilder

AddValue(string)

public ClassBuilder AddValue(string value)

Parameters

value string

Returns

ClassBuilder

Build()

Builds the final string of css classes, resolving conflicting Tailwind utilities in favour of the one added last. Classes that are not Tailwind utilities are kept as they are.

public string Build()

Returns

string

The final constructed string of css classes.