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

Removing SCSS included file warnings

I am building a Svelte project which relies on GDS components and styling from GOV UK frontend, and I get a lot of error messages similar to the one in the Warning message section below.Is there a way...

View Article


Sveltekit SPA mode error handling in tags

If you have a sveltekit project configured in SPA mode: export const ssr = false; in the +layout.ts, how do you handle an exception being thrown from the <script> tags:<!--...

View Article


Image may be NSFW.
Clik here to view.

Include HTML inside of component - svelte

One thing that I've been curious how to do in Svelte is include a components' HTML children in a place using svelte, like this:<Popup><h1>Hello World</h1></Popup>I've done some...

View Article

Form Enhancement with Superforms and Shadcn Svelte does not work in svelte 5

I've started a new project using svelte kit with svelte 5. I opted for shadcn-svelte and build a simple login form with superforms.<script lang="ts"> import type {PageData} from "./$types";...

View Article

SvelteKit Chrome Extension

I am trying to use SvelteKit to make a chrome extension. From my understanding, I need a manifest.json file inside the static folder. Because chrome does not allow inline scripts, I also need a...

View Article


Nodes on canvas - some strange behaviour

I've made a simple REPL using the excellent "Neodrag" package for dragging components.However, when I add a new node or resize nodes, they seem to interact with each other. For example, the new nodes...

View Article

Passing reactive props to children in Svelte 5

I'm really struggling to understand reactivity in Svelte 5.I've created a little class to encapsulate a data fetch operation:class DataResponse { data = $state([]); error = $state(); isLoading =...

View Article

SvelteKit: Packages not being able to access node functions

I am building an app with SvelteKit and publishing it to Cloudflare Pages, but it is some packages I am using are not able to access node native functions. Here's the build...

View Article


How to move caret to the last character of the input when bind:value is with...

I am trying to change the format of an input with a bind:value and a function, but when I change the format and in this case the length of the input changes compared to the original input the caret is...

View Article


Passing reactive props to children

I'm really struggling to understand reactivity in Svelte 5.I've created a little class to encapsulate a data fetch operation:class DataResponse { data = $state([]); error = $state(); isLoading =...

View Article

Is there a type for the $props() of a component?

Having a component// Comp.svelte<script lang="ts">interface Props { value?: number;}let { value }:Props = $props()</script>that will be mounted in a *.svelte.ts fileconst props =...

View Article

Svelte & Electron - import or require in preload.mjs

I'm working the first time with the combination Svelte and Electron and got some trouble in understanding the following behavior about the preload.mjs and ES-Module/CommonJS.My project is configured...

View Article

Ways to make layout load data both reactive + changeable?

I am returning a bunch of data from my +layout.tsI want the data to change when the url changesI also want to be able to modify filter, search, tag etc from the UI via input, dropdown...

View Article


"Uncaught (in promise) TypeError: ...img is undefined" when using...

I'm encountering an issue using @sveltejs/enhanced-img in my Svelte project. I've installed it via npm install --save-dev @sveltejs/enhanced-img and configured it in vite.config.js.My setup involves an...

View Article

markdown generated html is not styled by the styles specified by css

Good day,I am trying to create a markdown previewer using Svelte. I'm using the following libraries for different tasks:Marked library for parsing markdown,Highlight.js for highlighting code...

View Article


Image may be NSFW.
Clik here to view.

Svelte SVG draw canvas show broken image after build

Im using Svelte, I try to convert SVG to image. The SVG already render but the logo at the center is not. I use canvas to get SVG to image and draw logo at the center. As you can see everything is fine...

View Article

Using supabase storage works with JPG but not with SVG for my website

I use Sveltekit and supabase to store my assets for my website. I use the public URL to load files which works fine for JPGs, but when I try to load SVGs it shows a broken link.If I manually enter the...

View Article


Svelte - how to wait for data that is being passed in from parent component?

I'm learning Svelte and I want to use data from one JSON API in three components. The data looks like this:{"stats": {"currentYear": {"total": 6,"success": 6 },"thirty": {"total": 30,"success": 28...

View Article

Svelte form on:submit type TypeScript

I am trying to build a simple form in Svelte TypeScript.My on:submit looks like this: <form on:submit={onSubmit}>, and my onSubmit function is defined as:const onSubmit = (event: HTMLFormElement)...

View Article

Access state/variable/data from +layout.svelte inside +layout.ts

I implemented the master detail layout as shown hereRoute StructureMy route structure for the same looks like this in svelteroutes└── (news)└── [[news=newsMatcher]]└── [[tag]]├──+layout.svelte (list...

View Article
Browsing all 1539 articles
Browse latest View live


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