All notable changes to this project will be documented in this file.
- Update required phoenix_live_view version to also support Phoenix LiveView 1.0.
- Add
.formatter.exs
to files to allowimport_deps: [:cva]
.
variant/2
now properly supports boolean values. You can now do something like the following:
variant :disabled,
[true: "disabled-class", false: "enabled-class"],
default: false
# or
variant :disabled,
[true: "disabled-class"],
default: nil
def button(assigns) do
~H"""
<button class={@cva_class} disabled={@disabled}>
<%= render_slot(@inner_block) %>
</button>
"""
end
# ... where you use that component
<.button disabled>Click me</.button>
# -> <button class="disabled-class" disabled>Click me</button>
-
variant/2
does not automatically infer therequired
option anymore. If you want to make a variant mandatory, you have to provide therequired: true
option. -
variant/2
now allowsnil
as a valid value.
- Fixes an issue where defining 3 variants would cause an
attr
already defined error.
- Add
variant: 2
to formatter. - Fixes an issue where a
class
assign would accidentally be merged into@cva_class
without explicitly declaring it.
- Fix formatter exports
🚀 Initial release