Make :let directive value available in slot definition
See original GitHub issueIs 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:
- Created 3 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
the example in the tutorial of this subject does not work either!
https://svelte.dev/tutorial/slot-props
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.