Skip to content

Conversation

chasefleming
Copy link
Owner

Closes: #165

@chasefleming
Copy link
Owner Author

@whisk what do you think about this? Do you mind reviewing?

@whisk
Copy link
Contributor

whisk commented Oct 6, 2025

hi @chasefleming,
I think that your point about missing spaces is valid. Concatenation of strings with + is error prone, and that's why I usually use something like

strings.Join([]string{"btn", elem.If(isPrimary, "primary", "")}, " ")

This is not exactly neat and may add redundant spaces, but it's safe.

Can ClassNames be generalized for other attrs which may need multiple values separated by spaces? I can't think of any right now.

Otherwise the PR looks good with one minor comment with no comments :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ClassNames utility function for conditional CSS class handling

2 participants