Table of Contents

Class StyleVariantClass

Namespace
Velvet
Assembly
Velvet.Docs.dll

Parses a state-variant utility token of the form <variant>:<payload> (e.g. hover:bg-blue-500, focus:border-accent, active:w-[200px]).

USS class selectors cannot contain :, so these tokens are never added to the class list; the reconciler routes them to a Velvet.StyleVariantManipulator that toggles the payload when the matching pointer/focus state is active. The payload itself is an ordinary utility — a USS class (bg-blue-500) or an arbitrary value (w-[200px]).

public static class StyleVariantClass
Inheritance
object
StyleVariantClass

Methods

BreakpointPx(StyleVariantKind)

Min-width (px) at which a responsive variant activates. The default breakpoints: sm 640, md 768, lg 1024, xl 1280, 2xl 1536. Returns 0 for non-responsive kinds.

IsResponsive(StyleVariantKind)

True for the responsive min-width variants (sm:2xl:).

IsVariant(string?)

Returns true if token is a recognized state-variant token.

TryParse(string?, out StyleVariantKind, out string?)

Splits token into its variant kind and payload. Returns false for a null/empty token, an unknown variant prefix, an empty payload, or when the first : belongs to an arbitrary value (i.e. occurs inside [...], as in bg-[addr:key]). A named relational token (group-hover/sidebar:) parses to its kind with the name discarded; use the TryParse(string, out StyleVariantKind, out string, out string) overload to recover it.