All Questions
70 questions
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 ...
1
vote
1
answer
144
views
Svelte3: A modal at docroot with dynamic content
I am trying to implement a modal dialog box somewhat typical, but with a few prerequisites that I don't see how to implement the svelte way:
It needs to sit at docroot (and be free of parents ...
2
votes
1
answer
63
views
How to disambiguate svelte components?
I have the following typescript type:
type ItemTypes = (GameItem & { id: undefined }) | (CurrencyItem & { id: string });
The GameItem is an object that doesn't have the "id" ...
1
vote
1
answer
661
views
Prevent Svelte from adding random classes
I have a shadow-root component and I simply don't want svelte-kit to add those random classes to that specific element or its child elements. It would be nice if there was something in the settings ...
1
vote
1
answer
1k
views
Editing a form with SvelteKit
I've got an Artist page in SvelteKit. Its route looks like the following:
routes
artists
[slug]
+page.server.js
+page.svelte
new
+page.server.js
...
1
vote
1
answer
549
views
How to avoid overwriting context in nested components (like Tabs) in Svelte
Best-practice for negotiating between parent and child components is using context. For instance, here is an implementation for Tabs and Tab component: TabPanel will be visible by clicking on related ...
1
vote
1
answer
310
views
State scope in Svelte
I'm a beginner with Svelte and I have the following component:
<script>
let svgSelector = null;
const renderMap = () => {
const map = document.getElementById("map");
...
0
votes
1
answer
497
views
Svelte property not updating as expected in Sveltestrap Modal component
I am a React user, and am having trouble understanding how and when values get updated in svelte. I'm just trying to pass a value into a component updated via a user action. Here are the basics of my ...
0
votes
1
answer
3k
views
How to listen to a svelte event in a HTML page?
I have a simple Svelte button component as follows.
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { idGenerator } from '../utils/helpers';
export ...
1
vote
2
answers
2k
views
Svelte js How to pass styles to child (with passability to override)
In svelte, I want to write components in BEM style, so component was stylized by its own styles and then positioned from parent's styles
The problem: to do this, I need to put the component in a ...
1
vote
1
answer
3k
views
How to set Intersection Observer for a specific Svelte component/element for whole App?
Lets assume I have Icon.svelte component in /elements folder.
I have used that Icon component in various other components in whole application.
Is there any way to set intersection observer for that ...
1
vote
1
answer
2k
views
Svelte Simple form with file upload not working
I'm using svelte and svelte-forms-lib. I've got a form component that looks like:
<script>
import { createForm } from "svelte-forms-lib";
export let mode;
export let ...
-1
votes
2
answers
445
views
can SVELTE.js function code become a package or library?
so I create the component in svelte, and add to it custom logic,
but compile it.
and then use native javascript to use the compiled version without doing the npm install of svelte.
basically, I want ...
1
vote
1
answer
1k
views
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 ...
2
votes
1
answer
546
views
Show Frappe Chart in Svelte component
<script lang="ts">
import { onMount } from 'svelte';
import { Chart } from 'frappe-charts';
let chartElem;
const chartData = {
labels: ["12am-3am", "3am-6pm", ...