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

Provide data to main Layout from any route in SvelteKit

I have to following folder structure and I'm struggling to find the best way to provide my main layout with some props.src/└── routes/└── (app)/├── route1/│└──+page.svelte├──...

View Article


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 = $state.raw([]); let splitItems = $derived(items.splice(0,...

View Article


Is there anyway to control the snap animation using Svelte or TailwindCSS?

I have a snap-y snap-mandatory overflow-y-scroll container with several items inside. The snap is working, but I don't like how the snap is animated.Is there any way to control the animation of the...

View Article

cannot access $app/environment variable *building* in playwright

I need to access $app/environment var buildingI have no problem in dev.But when i run playwright test i get error $app package is not avail.I have no idea how to access this var, for $env vars I use...

View Article

How to get svelte component's children height?

I'm trying to create a component that will render it's children when it comes into the viewport, here's the code:<script lang="ts"> import type { Snippet } from 'svelte'; import { viewport } from...

View Article


Laravel 11 CORS problem on localhost with Svelte

I built a simple API in Laravel, with CORS parameters configured in cors.php and middleware. Tested on Postman and it works giving the response I wrote. When testing on Svelte it gives me the CORS...

View Article

How to get a component's children height?

I'm trying to create a component that will render it's children when it comes into the viewport, here's the code:<script lang="ts"> import type { Snippet } from 'svelte'; import { viewport } from...

View Article

Markdown-it-katex - how to make superscript?

This is my code (Svelte 5, sveltekit, tailwind):<script lang="ts"> import MarkdownIt from 'markdown-it'; import markdownItKatex from 'markdown-it-katex'; import 'katex/dist/katex.min.css'; const...

View Article


How do I use oninput this.reportValidity in svelte

This code works perfectly in HTML<input type="text" name="country" pattern="[A-z]{3}" oninput="if (typeof this.reportValidity === 'function') {this.reportValidity();}"/>How do I use it in...

View Article


How to triger $effect() with bound variables in svelte?

I have a variable that is correctly bound to its parent: its value changes on click, and that value is correctly displayed in both parent and bound child. You can test that in svelte...

View Article

How to change page title dynamically in Sveltekit?

I'm learning SvelteKit and this might be a very elementary question. But I could not figure out how to change the tab's title.In my src/+layout.svelte I have:<script> let title="My Site...

View Article

Keycloak init in Svelte and then serve data according to the token properties

Okay after ramming with this for several days I have to kindly ask the community.I have a Svelte project, which integrates with Keycloak instance. All my keycloak functions are located in separate...

View Article

Cannot access to values in store of Map in Svelte

I have simple store of new Map() and I like to iterate it in Svelte component. In the {#each} block i can see it iterates as many times as Map has elements but I can't see values.<script> import...

View Article


Media queries vs. svelte:window innerWidth - Which one is better way to build...

While building a responsive webpage using sveltekit, I found two ways to render different UIs depending on the device width: media queries and bind:innerWidth with svelte:window.Media query seems to be...

View Article

Unexpected character '@' when migrating from Svelte 4 to Svelte 5

I am migrating a a Svelte 4 app to a Svelte 5 app, I used the npx command linenpx sv migrate svelte-5This resulted in my <slot /> tag in my layout.svelte file on my front page being replaced with...

View Article


How to remain reactivity in SvelteMap between components

I have three files:App.svelte:<script> import Component from "./Component.svelte" import { items } from "./store.js" $items.set("a", { name: "John", index: "a" }) $items.set("b", { name: "Jack",...

View Article

Tailwind v4 - Remove unused colors during build (svelte project)

When I run the build script in my svelte kit tailwind project, with Tailwind v4, it add every single tailwind color. I only use one single tailwind color, so I'd like to remove them.I spent a while...

View Article


How to remove unused colors during build?

When I run the build script in my svelte kit tailwind project, with Tailwind v4, it add every single tailwind color. I only use one single tailwind color, so I'd like to remove them.I spent a while...

View Article

How to use SurveyJS Custom Item Template in Svelte?

In the documentation JS example JSX syntax is used which doesn't seem to be easily transferred to a .svelte file..?The vue example registers a component// main.jsconst app =...

View Article

Svelte variable not updating from localStorage without using setInterval and...

I have an app that stores items into locations in localStorage and then displays the items in HTML.One of the reasons i wanted to use Svelte was for reactive variables, but whenever I attempt to use a...

View Article
Browsing all 1539 articles
Browse latest View live


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