554 questions
2
votes
1
answer
75
views
Svelte 5: Typescript and rest props issue "'prop' is specified more than once"
I have component <Component> which is basically an instance of another component <Modal> (a modal used for a specific action).
For consistency and improved legibility I am passing all the ...
0
votes
1
answer
93
views
How i can manage a component that needs to use a custom event?
I’m using a custom Select component inside a table, and I want to make some reactive calculations in the parent component for example, updating the total price when a discount is selected through a ...
1
vote
0
answers
127
views
Svelte Routing - Cannot read properties of undefined (reading 'before')
Not able to get routing to work without a bug. The route works if I click on the link twice, the second time, the correct page renders. The first a console output error is generated.
ERROR:
Uncaught ...
0
votes
1
answer
96
views
Why my chrome extension is crashing during upload of image when Chrome is maximised?
I am using svelte to build a chrome extension which has the ability to upload images and Post that image to instagram. Here is my project directory structure.
├── .git/
├── .gitignore
├── .npmrc
├── ...
0
votes
1
answer
73
views
Export function from Svelte component
Component.svelte:
<script>
export function test(){
return "test";
}
</script>
App.svelte:
<script>
import { test } from "./Component.svelte" // error;
...
2
votes
2
answers
1k
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
1
answer
166
views
How to disable svelte-check error in HTML part of Svelte component?
I have a component written in Svelte 5, using $props() rune.
LogActions.svelte
<script lang="ts">
//@ts-expect-error
let { onSave }: { (): void } = $props() ;
</script>
<...
1
vote
1
answer
364
views
How to Wrap Each Child with a Tag in Svelte 5?
In Svelte 5, how can I wrap each child with a tag like the example below?
{#if children}
{#each children as child}
<button
onclick={() => {
handleClick();
}}
>
...
0
votes
1
answer
1k
views
How to bind a component instance in a type-safe manner in Svelte 5?
I'm following the tutorial provided by the Svelte team in their website!
There is this section in the tutorial that basically explains how we can expose certain functionalities from a custom component:...
0
votes
1
answer
582
views
Set `body` `background-color` programmatically in Svelte?
I'm making a site using Svelte and SvelteKit, and I'd like to use a predefined array of colors for styling in a normalized way-- if I change one of the values later, everywhere that styles using that ...
-1
votes
1
answer
90
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 ...
1
vote
1
answer
409
views
Display all svelte components in a folder
I have a couple of svelte components in a folder and I wish to display in a single page all the components in that folder.
The only way I've found is creating an index.ts file in that folder and then ...
0
votes
1
answer
138
views
Modify parent's footer slot from child
In Svelte, I am using the Modal component.
This component provides the possibility do declare a div with the property slot="footer".
This will keep the footer always at the bottom of the ...
0
votes
1
answer
69
views
Conditional Rendering of Contents of Navbar
I am trying to conditionally render different parts of my navbar to the user depending on if they are logged in or not. I initially achieved this by using the onMount function, but it is not ideal as ...
5
votes
1
answer
70
views
Why does the following event handler work in a Svelte component?
I have the following component Form.svelte:
<script>
export let onDelete;
</script>
<form>
<button type="submit">Update</button>
<button on:click={...
1
vote
1
answer
888
views
Astro.currentLocale in Framework Components for SSR
I've built an app localized by Astro's i18n routing.
To get the current locale, on server-side I use Astro.currentLocale and on client-side I use window.location.pathname with a helper function that ...
0
votes
2
answers
299
views
handle Esc key on form in a A11y friendly way
I have a form in a Svelte app like this:
<!-- markup for editing todo: label, input text, Cancel and Save Button -->
<form on:submit|preventDefault={onSave} class="stack-small" ...
0
votes
1
answer
92
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 ...
0
votes
1
answer
48
views
Store Component Attributes in a strongly typed array
In svelte, I would like to strongly type an array to match the properties that a specific component exports.
So in the following example I would like const things = [] to know that each item within ...
4
votes
1
answer
1k
views
Invalid configuration found in /Users/nickk/Documents/Pioneer_Frontend/components.json
In the svelte framework I installed Shadcn UI library and installed three of it's components but now when I try to install any other library it gives me this error.
Component.json file looks like this ...
0
votes
1
answer
444
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
90
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 ...
2
votes
0
answers
321
views
How to skip initial reactivity for a variable within svelte components?
I have a simple custom component in Svelte, where I use reactivity to execute some code.
<script lang="ts">
export let liked: boolean
$: {
//..code that should be ...
0
votes
0
answers
540
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 ...
0
votes
2
answers
950
views
Tailwind CSS missing from universal Svelte web component
I've managed to create a Svelte web component that can be used on external websites running on different frameworks.
The final problem I'm having is that Tailwind doesn't seem to be included in the ...