Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class object syntax #140

Merged
merged 2 commits into from Jun 27, 2021
Merged

Class object syntax #140

merged 2 commits into from Jun 27, 2021

Conversation

mhanberg
Copy link
Owner

Allows for conditionally setting classes on an element.

This is similar to Vue.js's Class Bindings - Object Syntax

div class: ["text-red-500": false, "text-green-500": true] do
  @user.name
end

results in

<div class="text-green-500">
  Homer Simpson
</div>

Allows for conditionally setting classes on an element.
@mhanberg
Copy link
Owner Author

Still needs docs

@mhanberg mhanberg merged commit d9f00e5 into main Jun 27, 2021
@mhanberg mhanberg deleted the mh/even-better-attrs branch June 27, 2021 16:04
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.

None yet

1 participant