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
Select.svelte
data.js
<script>
import { trees } from './data'
import Select from './Select.svelte'
let id_trees = '1'
let id_branches = '1'
$: branches = trees.find(tree => tree.id == id_trees).branches
</script>


<svelte:head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.13.0/cdn/themes/light.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.13.0/cdn/shoelace.js"></script>
</svelte:head>


<Select label="Trees" bind:value={id_trees}>
{#each trees as { id, name }}
<sl-option value={id}>{name}</sl-option>
{/each}
</Select>

<Select label="Branches" bind:value={id_branches}>
{#each branches as { id, name }}
<sl-option value={id}>{name}</sl-option>
{/each}
</Select>
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */