Skip to content

Make :let directive value available in slot definitionΒ #4966

@dasDaniel

Description

@dasDaniel

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions