Files
buzz/packages/ui/src/classes.ts
Arjun Mahanti 31b53e1afd feat(design-system): add portable open-source component library
Signed-off-by: Arjun Mahanti <arjun@squareup.com>
Co-authored-by: Codex <noreply@openai.com>
2026-09-09 08:24:52 -07:00

13 lines
476 B
TypeScript

/** Joins optional class names without rewriting semantic size roles. */
export function cx(...values: Array<string | false | undefined>) {
return values.filter(Boolean).join(" ");
}
/** Preserves Base UI state-aware className callbacks when adding the Buzz skin. */
export function skin<State>(
base: string,
custom?: string | ((state: State) => string | undefined),
) {
return (state: State) =>
cx(base, typeof custom === "function" ? custom(state) : custom);
}