This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

ClassMerge Pennington.UI.Styling

Tailwind-aware class merge a component uses to fold a per-instance *Class parameter over its variant base, so a passed utility knocks out the conflicting base utility instead of duplicating it. Site templates register one built from MonorailCssService.CreateClassMerger(...); bare hosts leave it unregistered and the component falls back to appending (conflicting base utilities are not removed, but the passed classes are at least present).

Constructors

ClassMerge

#
public ClassMerge(Func<string, string, string> merge = null)

Parameters

merge Func<string, string, string>
The conflict-aware merge, or null to append.

Methods

Apply

#
public string Apply(string baseClasses, string extra)

Folds extra over baseClasses. Returns baseClasses unchanged when extra is null or empty.

Parameters

baseClasses string
extra string

Returns

string

Pennington.UI.Styling.ClassMerge

namespace Pennington.UI.Styling;

/// Tailwind-aware class merge a component uses to fold a per-instance *Class parameter over its variant base, so a passed utility knocks out the conflicting base utility instead of duplicating it. Site templates register one built from MonorailCssService.CreateClassMerger(...); bare hosts leave it unregistered and the component falls back to appending (conflicting base utilities are not removed, but the passed classes are at least present).
public class ClassMerge
{
    /// Folds extra over baseClasses. Returns baseClasses unchanged when extra is null or empty.
    
public string Apply(string baseClasses, string extra)
;
public ClassMerge(Func<string, string, string> merge = null)
; }