question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make :let directive value available in slot definition

See original GitHub issue

Is your feature request related to a problem? Please describe.

I’d like to have the slot variables available within the definition. Currently I cannot use the variable to define value for class attribute

Describe the solution you’d like

ie:

<ListboxOption value={item} let:active class="{active ? 'i-am-active' : 'nope'}">{item.name}</ListboxOption>

Describe alternatives you’ve considered

I can retrieve the activeValue value, in this scenario, from another component higher up the chain and compute.

<ListboxOption value={item} let:active class="{activeValue === item ? 'i-am-active' : 'nope'}">{item.name}</ListboxOption>

alternatively, I could just nest the element

How important is this feature to you?

a nice to have

Additional context

reference: https://github.com/dasDaniel/svelte-listbox/blob/master/example/src/App.svelte

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ali-garajiancommented, Jul 16, 2022

the example in the tutorial of this subject does not work either!

https://svelte.dev/tutorial/slot-props

0reactions
stale[bot]commented, Dec 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can someone explain to me the let directive? : r/sveltejs - Reddit
Let directive is a way to pass a slot item back up to the parent? Not op, just trying to solidify it myself....
Read more >
How to bind variable declared with Svelte let directive?
Things I have tried so far. 1) Making FancyList to pass item index instead of item itself and binding items[index] instead of item...
Read more >
GNU make
GNU make. This file documents the GNU make utility, which determines automatically which pieces of a large program need to be recompiled, ...
Read more >
Slots - Vue.js
FancyButton renders slot content in its own template function ... to the slot by the child are available as the value of the...
Read more >
Using Slots In Vue.js - Smashing Magazine
To get access to the data passed to the slot, we specify the name of the scope variable with the value of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found