Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
import OptKit from 'optkit@latest';
const testAlert = () => alert("alert.");
const testPrompt = async () => {
let answer = await prompt("prompt?");
if (answer) alert(answer);
};
const testConfirm = async (_) => {
let confirmed = await confirm("confirmed?");
if (confirmed) alert(confirmed);
};
const openMenu = async (e) => {
menu(e, [
{ label: "testAlert()", onClick: testAlert },
{ label: "testPrompt()", onClick: testPrompt },
{ label: "testConfirm()", onClick: testConfirm },
]);
};
</script>

<OptKit/>

<p>
<button on:click={testAlert}>
alert()
</button>
</p>
<p>
<button on:click={testPrompt}>
prompt()
</button>
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */