registerVariant
fun <K : ComponentKind> registerVariant(name: String, variant: CssStyleVariant<K>, layer: String? = null)(source)
Register variants associated with a base style.
Since variants are always based on top of some target style, we allow the name parameter to start with a dash, which indicates that the variant name will be appended to the base style's name.
For example,
val ButtonStyle = CssStyle<ButtonKind> { ... }
// Here, the final name --> "button-brand"
// Without a CssName, the final name would be "button-brand-aware-orange-red"
// If the CssName was just "brand", then the final name would be, well, "brand"
@CssName("-brand")
val BrandAwareOrangeRedButtonVariant = ButtonStyle.addVariant { ... }
Content copied to clipboard
NOTE: Most of the time, you don't have to call this yourself, as the Gradle plugin will call it for you.