Skip to content

Commit

Permalink
fix 'dependent selects' example
Browse files Browse the repository at this point in the history
  • Loading branch information
mskocik committed Dec 18, 2024
1 parent 3ae4abd commit 8715036
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/routes/examples/+page.svelte.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,21 @@ This functionality is not strictly related to remote fetch, but it's typical how
you're done. If you require `parentValue` in your `fetch` URL, just use `[parent]` placeholder.

<label for="parent">Choose category first</label>
<Svelecte options={parentOptions} bind:value={parentValue} inputId="parent" clearable onChange={updateParent} />
<Svelecte options={parentOptions} bind:value={parentValue} inputId="parent" clearable />
<label for="child">Search for it</label>
<Svelecte {parentValue} bind:value={childValue} fetch="/api/[parent]?query=[query]" inputId="child" placeholder={childPlaceholder}/>

```svelte
<script>
let parentValue;
let value;
import Svelecte from 'svelecte';
let parentValue = $state(null);
let value = $state();
// ...
</script>
<Svelecte {options} bind:parentValue clearable />
<Svelecte {options} bind:value={parentValue} clearable />
<Svelecte {parentValue} bind:value fetch="/api/[parent]?search=[query]" />
```

Expand Down

0 comments on commit 8715036

Please sign in to comment.