Skip to main content

All Questions

Tagged with
0 votes
1 answer
121 views

Svelte styles are not applied to scope

I have a problem with adding styles in my Svelte components. I want to make sure that my styles are only applied within a specific component, but it doesn't work. Here is an example of a component. ...
sampa's user avatar
  • 639
0 votes
1 answer
45 views

Reactive variable updated from parent and child component

I have a parent component (List) which displays a list of child components (Block). Nested blocks have a button that allows the user to add/remove them to the selection. The List component also ...
Seglinglin's user avatar
5 votes
1 answer
3k views

Svelte 5: Passing state and derived values from children to parent (runes mode without stores)

I have a parent component with multiple draggable Item-components which will be created dynamically in the final app. Inside each Item I calculate the current position as well as a derived offset ...
The_Lab's user avatar
  • 107
0 votes
1 answer
56 views

I have a question about the svelte radio component

Radio components are being made and used. However, the input tag cannot be found because the parent page onMount runs earlier than the logic in the component. Is there any way to disable onMount on ...
car's user avatar
  • 3
2 votes
2 answers
2k views

Svelte 5: How to pass primitives reactivly across components/modules

I have a few dozens of reactive primitive values (like e.g. div_status = "frozen") which I need to pass between component/module boundaries, including +page.svelte files and svelte.js ...
The_Lab's user avatar
  • 107
0 votes
1 answer
127 views

Svelte Component with Internal Store per Instance connected with Props?

I have a parent component with many descendant components that need to access its values, ideally those values come from props that the app using the parent component can supply. I finally managed to ...
DevChefOwen's user avatar
1 vote
1 answer
3k views

Search component with a dropdown using svelte and shadcn-svelte

I'm trying to create a search component using Svelte and shadcn-svelte UI component library, Where I'll have a dropdown visible below the search input, when the user type a text that does exist in the ...
ZSmain's user avatar
  • 390
1 vote
1 answer
2k views

In svelte, I need to set the focus on an input element, but I get the error 'input.focus is not a function'

<script > let inx1 = "null"; let input =""; function handleClick() {input.focus(); } $: inx1 && handleClick(); </script> <textarea style="clear: ...
angelo alamia's user avatar
0 votes
2 answers
125 views

how to pass data upwards from child through an arbitrary amount of parents and changing it each time

How can I pass data from an innermost child component upwards through an arbitrary amount of different parent components, having each parent component modify the data all the way up until the ...
tsdexter's user avatar
  • 2,991
0 votes
1 answer
100 views

Specify type of generic typed component without using "export let prop"

I have a generic Modal component. This component gives the programmer a nice interface to write his modal in. For example, you can open an arbitrary form to insert values into. When the form is ...
Ólavur Nón's user avatar
1 vote
1 answer
82 views

Second instance of a component uses the function set on the first instance in svelte

I have created a component that I want to use to select a player. There can be two different players, and I was trying to have each one call a different function. However, when I select an option on ...
Jordan213's user avatar
0 votes
0 answers
168 views

Render multiple instances of bind-component / Sveltekit

I have the following component <script> let item = null export let text = "loading" onMount(() => { parent = item text = parent.querySelector("p&...
IamSebastn's user avatar
1 vote
1 answer
637 views

How do you unsubscribe from a Svelte store in a module context?

I have the following module: <script lang="ts" context="module"> import type { Config } from './types' import { config, // ... several more here } from './...
Mike's user avatar
  • 24.5k
1 vote
1 answer
697 views

Dynamically creating new component does not work in svelte

So I'm trying to create a new component when a button is pressed. Here's the place where the button is : <input type="color" id="todo-color" bind:value={todoColor} /> <...
Eli-ott's user avatar
  • 376
0 votes
1 answer
891 views

Svelte props are not passed to slot

I have a component with a slot that I want to pass props to. However, while I can pass a variable from the parent directly to the slot, passing it directly from the component that has the slot does ...
Markstar's user avatar
  • 873

15 30 50 per page
1
2 3 4 5