Fundamentals
Components
Code Utilities
Demo
BcStylesClassBuilder
Description
BcCssClassBuilder is a utility class that helps manage CSS class strings dynamically. It enables adding, removing, toggling, and formatting classes efficiently in a Blazor application.
Methods
AddClass ( string? cssClassString )
Adds a new CSS class or multiple classes (separated by spaces) to the class list.
void
RemoveClass ( string? cssClassString )
Removes an existing CSS class or multiple classes (separated by spaces) from the class list.
void
Clear ( )
Clears all stored CSS classes.
void
GetClasses ( )
Returns the final computed class string.
string
With ( string additionalClass )
Returns the current CSS class list with an additional class appended.
string
With ( object[] arguments )
Returns the current CSS class list with multiple additional classes appended.
string
ToString ( )
Returns the cached string of all applied CSS classes.
string
ToggleClasses ( bool switchFormatingState, string trueClass, string? falseClass = null )
Toggles between two CSS classes based on a boolean switch state.
void