-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Imagine the given scenario: You have an icon button component with two sizes, for each size you want not only to change the button classes but also the icon classes (so it resizes appropriately with the button):
variant :size, [sm: "text-sm px-2 py-1", lg: "text-lg px-4 py-2"]
slot :inner_block, required: true
def icon_button(assigns) do
~H"""
<button class={@cva_class}>
<.icon name="award" class="h-2 w-2 mr-2" />
<%= render_slot(@inner_block) %>
</button>
"""
endIt seems to me that this would be a good job for compound_variant if we had a way to split the classes instead of merging with @cva_class. Would you be interested in supporting something like this?
compound_variant :icon_class, "h-2 w-2 mr-2", size: :sm
compound_variant :icon_class, "h-4 w-4 mr-4", size: :lgReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels