huntabyte / shadcn-svelte

shadcn/ui, but for Svelte. ✨
https://shadcn-svelte.com
MIT License
5.04k stars 310 forks source link

Expose the 'builder' property in the slots whenever the parent exposes the 'asChild' property. #735

Open bfovez opened 8 months ago

bfovez commented 8 months ago

Describe the feature

I use this kind of thing:

<DropdownMenu.Item href={myHref} on:click={(e) => { ... e.preventDefault() ... }>
   ...
</DropdownMenu.Item>

I need fine control over the click event on the anchor. Indeed, the e.preventDefault() does not prevent the child anchor to actually trigger a nav action. For that matter, I need to activate the asChild property, which is present, but the builder property is not exposed in the slot.

We could modify the code, but we would end up modify the code of a bunch of shadcn-svelte components, which would prevent us to take advantage of the improvements yet to come.

huntabyte commented 8 months ago

I'm open to someone adding this to all the components. I don't have the time/energy to do it at the moment, especially with snippets on the horizon.

walker-tx commented 3 months ago

I can pick this up