Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Browsing all 1539 articles
Browse latest View live

How to pass value to rendered children?

I have an await block in my +layout.svelte for a product fetch function in the load function.When the promise is fullfilled it renders a +page.svelte as a children and I need to pass the product to...

View Article


Get used resources of page on compile-time

I am building a PWA and need an "You are offline"-Page. I've built an endpoint at /offline with images and css and it looks good. I registered the page it in the service worker to precache the offline...

View Article


Svelte 5 dynamic component loading: TypeScript errors

In my Svelte 4 app I dynamically load components, all of which have different props. Very simple reproduction (also available on the Svelte Playground):// App.svelte<script lang="ts"> import One...

View Article

How to fetch default action in +page.server.ts file in SvelteKit

I'm using SvelteKit and I've a form on my page. As I need to manipulate the data before it is sent, I cannot use the SvelteKit's default behaviour of form submission (using action attribute).So,...

View Article

Image may be NSFW.
Clik here to view.

SvelteKit routing not working ('/src/routes/about/+page.svelte' not mapped to...

I'm very new to sveltkit. Just followed supabase-svelte app refered to this link. The supabased examples work good as it says.Now I tried another things like routing reffering the official doc. It...

View Article


Image may be NSFW.
Clik here to view.

Cannot find name '$props' - missing types for Svelte 5 [closed]

I'm working on a Svelte 5 project with TypeScript in VS Code. I'm getting warnings for undeclared types for runes:`Cannot find name '$props'.How can I fix this? Do I need to install some types, or...

View Article

Why is my rune that holds an array, not being reactive?

Svelte5 Web Development Question About RunesIn a separate .svelte.js file I haveexport let allQuestionsRune = $state([new ObjectWithStringProperty("hi")])Then in a button onClick method in some +page...

View Article

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(); }}> {@render child?.()}</button>...

View Article


Understanding Svelte tick() lifecycle

I'm halfway through the Svelte docs and I have a hard time understanding the tick() lifecycle. Is there an alternative to it in React?For example, what it actually does in this example from the...

View Article


Svelte 5 and Superforms: Error Submiting Value of a DatePicker Component

I'm working with Svelte 5 and using Superforms for form handling. My goal is to bind a CalendarDate object from a custom DatePicker component to a Superforms field and then convert that CalendarDate to...

View Article

How to get value from svelte form component

I am using shadcn-svelte and it's form component. And I wanted to understand, how can I get the value entered by user on the server side. In the example below, I am trying to get the value note. As far...

View Article

Use $derived based on current state of self

When modifying the height of a sticky header based on a threshold for the yScroll position, the animation can loop infinitely if scrolling is stopped close to the threshold, as the shrinking header...

View Article

Turn a Svelte Component into HTML, CSS, and JS

My ideal end goal:Dynamically output HTML, CSS, and JS from a Svelte component so I can host it elsewhere (e.g. S3 bucket).Context:I have a Svelte app that collects information from usersFrom this...

View Article


KaTeX mhchem Extension Not Working in Svelte - Unable to Render \ce{} Command

I'm using KaTeX in a Svelte project to render chemical equations with the \ce{} command, but the mhchem extension isn't working. Other extensions like copytex load successfully.<script lang="ts">...

View Article

Dockerized Sveltkit app: Hot reload not working

With the help from SO community I was finally able to dockerize my Sveltekit app and access it from the browser (this was an issue initially). So far so good, but now every time I perform a code change...

View Article


How to create a scroll illusion with static background and fading text...

I'm trying to create a scroll-based effect in Svelte where the background remains static and the text content fades in and out as you scroll. The text should appear at the exact same position on each...

View Article

SvelteKit - Redirect after Form Submit

I have a problem with redirecting after submitting form in SvelteKit.I have some routes that needs authentication, before rendering it I'm checking if user is authenticated.routes│  ├──+page.svelte│...

View Article


netlify deploy fails with error [vite]: Rollup failed to resolve import

Deploying to netlify fails with error: [vite]: Rollup failed to resolve import..., but it works when I build locally using npm run build (same as netlify). The package that fails to resolve is...

View Article

"npm run dev" Command Doesn't Work - Giving "missing script: dev" error

I was trying to run this SVELT GitHub repo on local server:https://github.com/fusioncharts/svelte-fusionchartsI tried to launch it with "npm run dev" command. But I am seeing this error:npm ERR!...

View Article

Image may be NSFW.
Clik here to view.

Untitled blank loading page after starting server in Svelte

I'm new to Svelte and I'm just trying to run a Svelte project that should be working just fine. I followed the instructions of the repository, installing packages with pnpm i, and then when starting...

View Article
Browsing all 1539 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>