All Questions
Tagged with svelte-component javascript
178 questions
0
votes
1
answer
28
views
Parameters in svelte action not reactive
Svelte action that does things when keys are pressed:
import type { Action } from "svelte/action"
export const keys: Action<HTMLElement, boolean> = (node, active?: boolean) => {
...
0
votes
1
answer
47
views
Export function from Svelte component
Component.svelte:
<script>
export function test(){
return "test";
}
</script>
App.svelte:
<script>
import { test } from "./Component.svelte" // error;
...
0
votes
2
answers
122
views
Svelte child component props doesn't update on parent state change
Parent component:
<script>
import Child from "./Child.svelte"
import { onMount } from "svelte";
import apireq from "./api.js";
let items = $...
1
vote
2
answers
506
views
Other than children(), can I import and render multiple snippets in +layout.svelte that are defined in +page.svelte?
New to SvelteKit and trying to figure this part out...
Here's a couple of ways I was trying to achieve this, but the sidebar either doesn't load, or the navigation appears twice for some reason; with ...
0
votes
0
answers
127
views
How to add a submenu to my dropdown in svelte
I'm working on a svelte project where I have a top bar with a few menus. When I hover over the menus a dropdown will appear below with some menu items. Some menu items have subitems that I want to ...
0
votes
1
answer
141
views
Save data submitted from a Form into a Store in Sveltekit
So I've got the following component working so far records/new/+page.svelte:
<script>
import RecordForm from "../../../components/forms/RecordForm.svelte";
import TrackForm ...
0
votes
1
answer
63
views
Is there a way to maintain information in an iframe when i change tabs?
I have a webpage with several tabs. Inside one of them I include an iframe as a way to manage certain properties, therefore I need the data to be persistent. Each time I change to another tab and come ...
0
votes
1
answer
85
views
How does the parent component re-execute a function after a Svelte child component changes?
I have a svelte code.I want to implement a function that the parent component re-executes after the child component is updated.
I am facing a problem now.After the child component is updated, the ...
-1
votes
2
answers
142
views
Binding two number inputs to variables so one input is always bigger than or equal to other
I want to have two inputs:
Input A initialy containing a prop named "min" showing the maximum number possible in inputs
Input B initialy containing a prop named "max" showing the ...
0
votes
1
answer
365
views
on:click event not firing from within @error.svelte
I have a SvelteKit app with an @error.svelte page at the root of the /routes folder. Inside of this page, I have two buttons. One is in the header and the other one trigger's a page event when clicked ...
0
votes
1
answer
74
views
Svelte Checkbox input state does not match to html checkbox state
I am having problems with my custom checkbox component.
My goal is for the parant to have control over the selected state of the input. But every time I click the checkbox it gets selected even if ...
0
votes
1
answer
56
views
I have a question about the svelte radio component
Radio components are being made and used.
However, the input tag cannot be found because the parent page onMount runs earlier than the logic in the component.
Is there any way to disable onMount on ...
0
votes
1
answer
283
views
svelte create and pass component as html element
I'm using a library which requires me to create an html element and pass that element. Then the library puts the element in the correct place internally.
The problem I'm facing is that the element i ...
0
votes
0
answers
446
views
Svelte Component Errors: Cannot read properties of null (reading 'current'), TypeError: unsubscribe is not a function
I have a component that accesses a svelte store writable but the component just gets rendered before the data arrives into the store variable.
This are the errors
enter image description here
I want ...
1
vote
1
answer
1k
views
How is component inheritance done in Svelte?
I currently have a Modal.svelte component that uses native , I would like to create another component called ModalSheet.svelte whose parent is Modal.svelte.
Is this possible in Svelte without ...