svelte-component Questions
5
To import and use svg file in sveltekit I refer to this article
https://riez.medium.com/svelte-kit-importing-svg-as-svelte-component-781903fef4ae
By the way, when I finally input the code
<svelt...
Precaution asked 30/4, 2021 at 16:33
8
Solved
How would I do something like this:
<style>
Nested {
color: blue;
}
</style>
<Nested />
i.e. How do I apply a style to a component from its parent?
Imputation asked 11/7, 2019 at 12:1
3
Solved
I have a modal component and I want to be able to destroy it when the user clicks on the x button, I also have a notification popup that destroys itself after an interval but I'd like to give the u...
Tearjerker asked 1/6, 2020 at 6:12
1
I'm working on an app that renders a tree structure graphically. There are various node types in the tree, each with a corresponding Svelte component which renders it.
One of the features of the ap...
Adin asked 29/8, 2021 at 5:14
2
Solved
I want to get the user agent on the load function to choose whether to perform server-side rendering or not depending on the visitor is googlebot or not.
How can I access it inside the load functio...
Goblin asked 4/4, 2021 at 19:54
1
Solved
I'm trying to use Svelte to create a simple reactive component. The component loads data from an api server onMount and updates a reactive value (which updates a html element).
I have a simple vite...
Arlettearley asked 29/6, 2023 at 2:7
2
Solved
I use Svelte i18n for my project, it works perfectly in my Svelte components.
But I have some JS files (for constants for example), I want to use i18n to translate some keys, like (in /services/con...
Bio asked 8/9, 2021 at 17:44
3
Solved
I work in a group that has several projects, and each one is written in a different framework. We would like to have some self-contained widgets whose behavior and appearance are standard, but can ...
Pugh asked 9/4, 2020 at 23:0
2
Solved
I have doubts about how to create a Custom element API. I have followed the documentation, but I get the following warning:
The 'tag' option is used when generating a custom element. Did you
forge...
Atherosclerosis asked 4/3, 2020 at 15:6
1
Solved
When you look at this code:
<script lang="ts">
import RedThing from "./RedThing.svelte";
import GreenThing from "./GreenThing.svelte";
const things: Record&l...
Cristinacristine asked 16/3, 2023 at 8:7
3
Solved
I'm trying to create custom-element (web component) in svelte 3. I can't find any way to style nested components from css. Svelte removes styles before injecting them to <style> inside of Sha...
Confluence asked 5/9, 2019 at 9:8
2
I'm using svelte to create a personal website. I want to place a chunk of javascript code in the head of my final HTML code, which is based on a svelte component. So I have something like
<svetl...
Verbenaceous asked 14/8, 2020 at 19:55
2
I have a load function in SvelteKit. It fetches some data.
Is there a way I can display a loader before load function resolves? Or have some SSG that will be updated once SSR is resolved? Anything ...
Allynallys asked 18/2, 2022 at 0:9
4
Solved
One of my components is subscribed to a variable in a store. Whenever there is a change in that store var, I want to trigger a function.
stores.js
import { writable } from "svelte/store"...
Myronmyrrh asked 16/11, 2020 at 13:25
3
Solved
How to pass data (ex: Navbar Title) to a component used in the parent element?
<!-- _layout.svelte -->
<script>
import Nav from "../components/Nav.svelte";
let navTitle = &q...
Phares asked 30/8, 2020 at 2:48
4
Solved
SvelteKit v1.0.0-next.324
I have a SvelteKit component that is used in multiple places in my app, and it needs to fetch its own data from one of my endpoints.
I read this question that states I can...
Flashback asked 10/6, 2022 at 19:28
4
I have a component called WastedTime.svelte with a value wastedTime. There's also a function to change the value to 50 (in my real code, this does an animation but this is a reduced test case for S...
Parapet asked 8/10, 2019 at 13:48
2
Solved
I have a writable store with following data
let array= writable({
skills: [{
id: 1,
name: "Wordpress",
knowledge: 0.9
},
{
id: 2,
name: "Js",
knowledge: 0.8
} ]
})
I want to animat...
Chaotic asked 6/12, 2019 at 18:10
4
Solved
Context
In my Svelte app, I have multiple pages, each showing one or multiple videos.
For rendering the videos I reuse a video component (simplified):
// video component
<video poster="{sour...
Binky asked 15/11, 2019 at 12:26
2
I'm making a simple app based on socket connection. Basically one user is deciding what other users can see. One of functionalities is to start timer for other users. So, there is a Timer component...
Edlin asked 28/10, 2021 at 7:19
1
Solved
Is there any way to rename/alias props in svelte?
For example, if I have a component which takes a foo prop but I also want a foo local variable for the current state, is there any way to rename th...
Melan asked 22/3, 2022 at 14:32
2
Solved
How can I create variables inside Svelte's HTML like in React, or is it not at all how I am supposed to use Svelte. I know the example below is trivial but I'm thinking of a case where I really nee...
Youlandayoulton asked 26/2, 2022 at 12:1
1
Solved
I'm creating some custom components in svelte and I didn't understood how to pass events as props such as on:click, on:mouseup, on:whatever, I tried in the followings way but they didn't work:
// b...
Brat asked 1/1, 2022 at 16:15
2
Solved
I'm trying to animate this list of Widgets. Of course I can't just animate:flip a component, Svelte needs a DOM element.
<!-- invalid -->
{#each widgets as widget (widget.id)}
<Widget {.....
Premillennialism asked 3/11, 2021 at 22:27
1
Solved
I have several Svelte components and a custom writable store. The store has an init function which is async and which fills the store's value with some REST API's db's table's data. My components m...
Erased asked 8/10, 2021 at 18:56
1 Next >
© 2022 - 2025 — McMap. All rights reserved.