diete-design / diete.design

https://diete.design
MIT License
0 stars 0 forks source link

Button on:click is not working #38

Closed agazso closed 1 month ago

agazso commented 1 month ago

This does nothing:

<Button {dimension} variant={'darkoverlay'} on:click={() => alert('click')}><Copy size={24} /></Button>

This works:

<button on:click={() => alert('click')}><Copy size={24} /></button>
vojtechsimetka commented 1 month ago

Svelte 5 changes on:click to onclick. There is a good reason to do that. The legacy way still works on html elements for backward compatibility but afaik will be removed.

vojtechsimetka commented 1 month ago

https://svelte-5-preview.vercel.app/docs/event-handlers

agazso commented 1 month ago

Thanks, good to know. The plain onclick worked for me.