on:click not working with Button component #1571
Unanswered
HonigBaer1
asked this question in
Help
Replies: 1 comment
-
<script lang="ts">
import { Button } from '$lib/components/ui/button';
</script>
--<Button on:click={() => alert("Hello World")}>Click me</Button>
++<Button onclick={() => alert("Hello World")}>Click me</Button> i.e. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am using SvelteKit with Svelte 5 and the latest version of Shadcn-Svelte. I have a problem with using the on:click feature of the component. When I try to add an on:click event to the button, the function never runs. I looked throught he repo to find examples on how to use it, but nothing that helped me. Below I have my example which doesnt work:
I installed the component using the npx command from the docs:
npx shadcn-svelte@next add button
+page.svelte
If there is any more information I can provide, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions