Shadix.Cn (shadix v0.0.1)

Copy Markdown View Source

Class-name composition for Shadix components.

cn/1 flattens a list of class values and joins the truthy, non-empty ones with single spaces. It does NOT resolve conflicting Tailwind utilities — that is handled by Tailwind v4 cascade layers, so a caller's class always wins over a component default regardless of order.

Summary

Functions

Joins a (possibly nested) list of class values into a single class string, dropping nil, false, and empty strings.

Functions

cn(classes)

@spec cn(list()) :: String.t()

Joins a (possibly nested) list of class values into a single class string, dropping nil, false, and empty strings.

iex> Shadix.Cn.cn(["px-4", nil, "font-medium"])
"px-4 font-medium"