variantjs / vue

Vue Variantjs
https://variantjs.netlify.app
182 stars 13 forks source link

Use other element instead of button for dropdown #18

Closed Chappie74 closed 3 years ago

Chappie74 commented 3 years ago

Is it possible to use a custom element to trigger the dropdown? I've tried multiple things, but it seems the top element is still using

alfonsobries commented 3 years ago

@Chappie74 the dropdown component have a tagName prop that you can use to define the tag that will wrap the trigger, if you want to change the content of the trigger you can use the trigger slot.

For example, let say that you want to use a div as the wrapper and add and span with an icon:

<t-dropdown tag-name="div">
<template #trigger>
<span class="wharver">Open me <SVG .... /></span>
</template>
<!-- content of the dropdown -->
</t-dropdown>

^ made that from memory but should work

ch-henri commented 3 years ago

Thank you for your answer works great! How can i specify a variant for the generated button ?

Chappie74 commented 3 years ago

Thanks. I ended up switching to daisy UI. Glad it helped someone else though.